Welcome! Log In Create A New Profile

Advanced

Re: rewrite rules cms phpwcms not working

February 23, 2015 01:51PM
Hi Francis,

after some testing I use this rules now. These are working fine with my environment.

**Nginx Site Config /etc/nginx/sites-available/default :**
map $request_uri $bit_of_qs {
default "";
~/(?P<name>.*)\.html $name;
}
...
server {
...
location ^~ /config/phpwcms/ { deny all; }
location ^~ /filearchive/ { deny all; }
location ^~ /upload/ { deny all; }
location ~ /\. { access_log off; log_not_found off; deny all; }
location / {
try_files $uri @phpwcms;
}
location @phpwcms {
fastcgi_pass unix:/var/run/php5-fpm/default.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param QUERY_STRING $bit_of_qs&$query_string;
}
location ~* ^.+\.php$ { return 404; }
...
}

I hope this rules will catch all the following needs.
1. Deny access to folders /config/phpwcms, /filearchive, /upload
2. Deny all hidden files
3. Rewrite /index.php...
4. Ignore and do not show any other php file at root folder or any other sub folder to the internet

Is there something that should be improved?

One thing that is still happen is the following error message. No idea which "undefined constant Y" means.

**Nginx Error Log**
[error] 2798#0: *14 FastCGI sent in stderr: "PHP message: PHP Notice: Use of undefined constant Y - assumed 'Y' in /xxx/xxx/xxx/xxx/public_html/include/inc_front/front.func.inc.php(2287) : eval()'d code on line 1" while reading response header from upstream, client: 192.x.x.x, server: hometest.home.local, request: "GET /home_de.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm/default.sock:", host: "hometest.home.local", referrer: "https://hometest.home.local/"

Thanks
Daniel
Subject Author Posted

rewrite rules cms phpwcms not working

dansch8888 February 15, 2015 09:02AM

Re: rewrite rules cms phpwcms not working

Francis Daly February 16, 2015 03:38PM

Re: rewrite rules cms phpwcms not working

dansch8888 February 17, 2015 06:26PM

Re: rewrite rules cms phpwcms not working

Francis Daly February 18, 2015 04:26PM

Re: rewrite rules cms phpwcms not working

dansch8888 February 23, 2015 01:51PM

Re: rewrite rules cms phpwcms not working

Francis Daly February 24, 2015 03:40PM

Re: rewrite rules cms phpwcms not working

dansch8888 March 18, 2015 05:53PM

Re: rewrite rules cms phpwcms not working

dansch8888 March 19, 2015 05:03PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready