标签:
企业模板网站分享
在nginx服务器上设置UWA伪静态,需修改nginx的配置文件。
PHP设置部分:location ~ \.php { # 以下两行为避免,*.php文件不存在,而PHP-FPM(PHP FastCGI) 返回No input file specified错误,直接指向站点根目录下的404.html try_files $uri /www/lib/404/404.error.html; fastcgi_intercept_errors off; fastcgi_pass 127.0.0.1:1234; #1234根据自己的PHP端口设置 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; # 以下是为了让Nginx支持PATH_INFO set $path_info ""; set $real_script_name $fastcgi_script_name; if($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; fastcgi_connect_timeout 120; fastcgi_send_timeout 120; fastcgi_read_timeout 120; fastcgi_buffers 8 128K; fastcgi_buffer_size 128K;}站点部分:server { listen 80; server_name asthis.net; #网站域名 root /www/root/uwa; #网站根目录 charset UTF-8; #网站编码 location / { if(!-e $request_filename){ #如果没有找到相应文件 rewrite ^/(.*)$ /index.php/$1 last; #设置伪静态规则 } index index.php; } include php; include error;}
PHP设置: nginx服务器伪静态怎么设置?
原文地址:http://www.cnblogs.com/zuimoban/p/5649237.html