# HTML as PHP

**URL:** <https://www.ruby-forum.com/t/html-as-php/218981>\
**Category:** NGINX\
**Created:** [April 18, 2012, 12:18am UTC](https://www.ruby-forum.com/t/html-as-php/218981 "2012-04-18T00:18:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [April 18, 2012, 12:18am UTC](https://www.ruby-forum.com/t/html-as-php/218981/1 "2012-04-18T00:18:10Z")

</div>

Hello,

i want html files use as php file. So i have write the follow config:

/etc/nginx/nginx.conf  
server {  
listen 80;  
server\_name silviosiefke\_de;  
access\_log /var/www/silviosiefke\_de/log/access\_log main;  
error\_log /var/www/silviosiefke\_de/log/error\_log info;

location / {  
root /var/www/silviosiefke\_de/htdocs;  
index index.html index.htm index.php;  
}

#location /article-(\d+).html$ {  
#try\_files $uri $uri/ /blogdetail.html?id=$1;  
#}

# pass the PHP scripts to FastCGI

location ~ .(php|htm|html)$ {  
#location ~ .php$ {  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_index index.php;  
fastcgi\_param SCRIPT\_FILENAME  
/var/www/silviosiefke\_de/htdocs$fastcgi\_script\_name;  
include /etc/nginx/fastcgi\_params;  
}

location ~ /.ht {  
deny all;  
}  
}

When i make restart nginx and go on the side i read only Access denied.  
In the log i have:

access.log  
192.168.0.22 - - [18/Apr/2012:00:15:54 +0200] “GET /blog/manage.html  
HTTP/1.1” 403 25 “-” “Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de-de)  
AppleWebKit/535+ (KHTML, like Gecko) Version/5.0 Safari/535.4+  
Midori/0.4” “-”

No entrys in the error.log. Has someone an idea?

Regards  
Silvio

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 18, 2012, 12:57am UTC](https://www.ruby-forum.com/t/html-as-php/218981/2 "2012-04-18T00:57:08Z")

</div>

On Wed, 2012-04-18 at 00:17 +0200, Silvio S. wrote:

> location ~ /.ht {  
> deny all;  
> }

This also matches .html files. Try making your regex more explicit.

Cliff

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 18, 2012, 1:03am UTC](https://www.ruby-forum.com/t/html-as-php/218981/3 "2012-04-18T01:03:18Z")

</div>

Hello,

On Tue, 17 Apr 2012 15:56:34 -0700  
Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Wed, 2012-04-18 at 00:17 +0200, Silvio S. wrote:
> 
> > location ~ /.ht {  
> > deny all;  
> > }
> 
> This also matches .html files. Try making your regex more explicit.

ok i have delete the part, but the error is the same. Access Denied.  
And in the logs the same message, 403.

Regards  
Silvio

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 18, 2012, 1:11am UTC](https://www.ruby-forum.com/t/html-as-php/218981/4 "2012-04-18T01:11:20Z")

</div>

On Tue, 2012-04-17 at 15:56 -0700, Cliff W. wrote:

> On Wed, 2012-04-18 at 00:17 +0200, Silvio S. wrote:
> 
> > location ~ /.ht {  
> > deny all;  
> > }
> 
> This also matches .html files. Try making your regex more explicit.

My mistake, it doesn’t. Check these:

1. file/directory permissions are correct
2. is the php app is setting the status to 403?

Regards,  
Cliff

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 18, 2012, 1:13am UTC](https://www.ruby-forum.com/t/html-as-php/218981/5 "2012-04-18T01:13:12Z")

</div>

On Wed, 2012-04-18 at 01:02 +0200, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ok i have delete the part, but the error is the same. Access Denied.  
> And in the logs the same message, 403.

Can you also check the main nginx error log?  
Usually /var/log/nginx/error.log.

Cliff

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 18, 2012, 1:20am UTC](https://www.ruby-forum.com/t/html-as-php/218981/6 "2012-04-18T01:20:20Z")

</div>

On Tue, 17 Apr 2012 16:12:33 -0700  
Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can you also check the main nginx error log?  
> Usually /var/log/nginx/error.log.

Thats stand in the main error.log

2012/04/18 01:00:08 [info] 6802#0: Using 32768KiB of shared memory for  
push module in /etc/nginx/nginx.conf:85  
2012/04/18 01:00:08 [notice] 6330#0: signal 15 (SIGTERM) received,  
exiting  
2012/04/18 01:00:08 [notice] 6332#0: exiting  
2012/04/18 01:00:08 [notice] 6332#0: exit  
2012/04/18 01:00:08 [notice] 6330#0: signal 17 (SIGCHLD) received  
2012/04/18 01:00:08 [notice] 6330#0: worker process 6332 exited with  
code 0  
2012/04/18 01:00:08 [notice] 6330#0: exit  
2012/04/18 01:00:08 [notice] 6817#0: using the “epoll” event method  
2012/04/18 01:00:08 [notice] 6817#0: nginx/1.0.15  
2012/04/18 01:00:08 [notice] 6817#0: OS: Linux 3.2.14  
2012/04/18 01:00:08 [notice] 6817#0: getrlimit(RLIMIT\_NOFILE): 1024:4096  
2012/04/18 01:00:08 [notice] 6818#0: start worker processes  
2012/04/18 01:00:08 [notice] 6818#0: start worker process 6820  
2012/04/18 01:12:29 [notice] 6818#0: signal 15 (SIGTERM) received,  
exiting  
2012/04/18 01:12:29 [notice] 6820#0: exiting  
2012/04/18 01:12:29 [notice] 6820#0: exit  
2012/04/18 01:12:29 [notice] 6818#0: signal 17 (SIGCHLD) received  
2012/04/18 01:12:29 [notice] 6818#0: worker process 6820 exited with  
code 0  
2012/04/18 01:12:29 [notice] 6818#0: exit  
2012/04/18 01:12:32 [info] 7036#0: Using 32768KiB of shared memory for  
push module in /etc/nginx/nginx.conf:85  
2012/04/18 01:12:32 [notice] 7040#0: using the “epoll” event method  
2012/04/18 01:12:32 [notice] 7040#0: nginx/1.0.15  
2012/04/18 01:12:32 [notice] 7040#0: OS: Linux 3.2.14  
2012/04/18 01:12:32 [notice] 7040#0: getrlimit(RLIMIT\_NOFILE): 1024:4096  
2012/04/18 01:12:32 [notice] 7041#0: start worker processes  
2012/04/18 01:12:32 [notice] 7041#0: start worker process 7043  
2012/04/18 01:12:57 [info] 7058#0: Using 32768KiB of shared memory for  
push module in /etc/nginx/nginx.conf:85  
2012/04/18 01:12:57 [notice] 7041#0: signal 15 (SIGTERM) received,  
exiting  
2012/04/18 01:12:57 [notice] 7043#0: exiting  
2012/04/18 01:12:57 [notice] 7043#0: exit  
2012/04/18 01:12:57 [notice] 7041#0: signal 17 (SIGCHLD) received  
2012/04/18 01:12:57 [notice] 7041#0: worker process 7043 exited with  
code 0  
2012/04/18 01:12:57 [notice] 7041#0: exit  
2012/04/18 01:12:58 [notice] 7073#0: using the “epoll” event method  
2012/04/18 01:12:58 [notice] 7073#0: nginx/1.0.15  
2012/04/18 01:12:58 [notice] 7073#0: OS: Linux 3.2.14  
2012/04/18 01:12:58 [notice] 7073#0: getrlimit(RLIMIT\_NOFILE): 1024:4096  
2012/04/18 01:12:58 [notice] 7074#0: start worker processes  
2012/04/18 01:12:58 [notice] 7074#0: start worker process 7076

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 18, 2012, 1:27am UTC](https://www.ruby-forum.com/t/html-as-php/218981/7 "2012-04-18T01:27:48Z")

</div>

On Tue, 17 Apr 2012 16:10:55 -0700  
Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. file/directory permissions are correct

gentoo-desk htdocs # ls -l  
insgesamt 40  
drwxr-xr-x 2 siefke siefke 4096 18. Apr 00:08 blog  
-rw-r–r-- 1 siefke siefke 1406 18. Mr 2011 favicon.ico  
drwxr-xr-x 2 siefke siefke 4096 16. Apr 20:02 howto  
drwxr-xr-x 4 siefke siefke 4096 16. Apr 13:38 img  
drwxr-xr-x 2 siefke siefke 4096 18. Apr 00:08 inc  
-rw-r–r-- 1 siefke siefke 1137 17. Apr 22:45 index.html  
-rw-r–r-- 1 siefke siefke 17 14. Apr 00:09 info.php  
-rw-r–r-- 1 siefke siefke 43 16. Apr 20:28 robots.txt  
-rw-r–r-- 1 siefke siefke 508 16. Apr 20:28 sitemap.xml

> 1. is the php app is setting the status to 403?

The mistake come in blog directory, ok i try in root without any  
php inside html, but it come too Access denied.

The complete nginx.conf → [http://nopaste.info/d7665fafff.html](http://nopaste.info/d7665fafff.html)  
The php-php.conf → [http://nopaste.info/717a0a166f.html](http://nopaste.info/717a0a166f.html)

Thank u for ur Help.

Regards  
Silvio

---

<div class="post-metadata">

**Author:** ![silviosilva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@silviosilva](https://www.ruby-forum.com/u/silviosilva)\
**Post date:** [April 29, 2012, 7:31pm UTC](https://www.ruby-forum.com/t/html-as-php/218981/8 "2012-04-29T19:31:28Z")

</div>

Hello,

when used Nginx with PHP-FPM, should set the follow in your fpm config.

security.limit\_extensions = .php .html

Regards  
Silvio
