Welcome! Log In Create A New Profile

Advanced

Apache to Nginx

Posted by geek876 
Apache to Nginx
July 06, 2017 06:03AM
Dear All,

We are into a migration project form Apache -> Nginx for a PHP site.

Our project folder consists of

project
|-- www
|-- lib

The www as expected contains all php/html files/directories and lib contains libraries.

The 'document root' within Apache is set to 'project' folder with a rewrite rule:

RewriteEngine on
RewriteRule ^/(.*)$ /project/www/$1

This is so that people can't access /project/lib via the web. This works perfectly fine within Apache.

Within NGINX, to replicate the above, we have a location block with rewrite:

location / {
root /project
rewrite ^/(.*)$ /www/$1 break;

}

This works but not when the page is reloaded using PHP_SELF.
Within certain pages, we have PHP_SELF that reloads the page when a user does some action on that page. The reloading re-introduces '/www/' as below:

1. URL when First time page is accessed: http://x.com/DL/control_panel/x.php (works fine)

2. URL when Page is reloaded via PHP_SELF: http://x.com/www/DL/control_panel/x.php (Does'nt Work)

Access log for 1: "GET /DL/control_panel/x.php"
Access log for 2: "GET /www/DL/control_panel/.php"

How can I rectify the above? basically for 2 above, it should NOT have /www in the front I suppose.

Any help would be greatly appreciated.

Thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
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