Hi All, I am trying to migrate a website from Apache2 to Nginx. The new server is installed with Debian Lenny + Nginx 0.6.32 + PHP 5.2.6 + FastCGI. I have the following directory structure: 1. /var/www/nginx/abc.com/htdocs - Main site 2. /var/www/nginx/abc.com/htdocs/cms - Sub site This is my nginx vhost config: # Redirect to www server { listen 0.0.0.0:80; server_name abc.com; rewrite ^(.*) http://www.abc.com$1 permanent; } server { listen 0.0.0.0:80; server_name www.abc.com; root /var/www/nginx/abc_production/htdocs; index index.php; include /etc/nginx/fastcgi.conf; # serve static files location ~ ^/(cache|cms|css|img|js|language|gallery)/ { root /var/www/nginx/abc_production/htdocs; expires 30d; } location ~ ^/cms { fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx/abc_production/htdocs/cms$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } location ~ \.php { fastcgi_index index.php; if ($request_filename ~ '.+\.(jpg|jpeg|gif|css|png|js|ico|html)$') { access_log off; expires 1d; } fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } access_log /var/log/nginx/abc_production-access.log main; error_log /var/log/nginx/abc_production-error.log; } This is the problem I encounter with my current vhost config: 1. Typing the URL http://www.abc.com will get the nginx to serve the correct php file index.php in /var/www/nginx/abc_production/htdocs/index.php. 2. When I try to access http://www.abc.com/cms, the server will serve me the raw content of the index.php file under /var/www/nginx/abc_production/htdocs/cms/. I want to know how I can get nginx to serve me the sub site as the cms subdirectory contains the content management software to add stuffs to the main site. What is wrong with my nginx vhost config? Regards.
Have you tried to leave out this section? Code: location ~ ^/cms { fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx/abc_production/htdocs/cms$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; }