当前位置:Gxlcms > PHP教程 > Nginx虚拟目录配置文件(包含PHP配置与重写)

Nginx虚拟目录配置文件(包含PHP配置与重写)

时间:2021-07-01 10:21:17 帮助过:24人阅读

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;
	}
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了Nginx虚拟目录配置文件(包含PHP配置与重写),包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行