Home > Backend Development > PHP Tutorial > Nginx virtual directory configuration file (including PHP configuration and rewriting)

Nginx virtual directory configuration file (including PHP configuration and rewriting)

WBOY
Release: 2016-07-29 09:15:48
Original
1162 people have browsed it
server {
    listen       80;
    server_name  www.xxxx.com;
    root   /www/xxxx;
    location / {
        index  index.html index.htm index.php;
        if ( !-e $request_filename ){
                                rewrite ^/(.*)$ /index.php last;
                                break;
                }
    }
	location ~ .*\.(php|php5)?$
	{
			try_files $uri =404;
			fastcgi_pass  127.0.0.1:9000;
			fastcgi_index index.php;
			include /etc/nginx/fastcgi.conf;

			fastcgi_split_path_info ^(.+\.php)(.*)$;
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
			include fastcgi_params;
	}
}
Copy after login

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the Nginx virtual directory configuration file (including PHP configuration and rewriting), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template