支持thinkphp 伪静态
或者 URL链接是 index.php?s=xxxxx的,当然也可以改成你自己,只要修改try_files $uri $uri/ /index.php?s=$uri&$args;
此处就可以了
文件名lanmps.com.conf
风.fox
内容如下
server {
#侦听80端口
listen 80;
#定义使用 lanmps.com访问
server_name lanmps.com;
#定义服务器的默认网站根目录位置
root /www/wwwroot/default;
index index.html index.htm index.php;
#默认请求
location / {
#定义首页索引文件的名称
#index index.html index.htm index.php;
try_files $uri $uri/ /index.php?s=$uri&$args;
}
# 定义错误提示页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# 加载伪静态配置 或自定义配置
#include /www/wwwroot/default/lanmps-*.conf;
#静态文件,nginx自己处理
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|json|swg)?$ {
#过期30天,静态文件不怎么更新,过期可以设大一点,
#如果频繁更新,则可以设置得小一点。
expires 30d;
}
location ~ .*\.(js|css)?$ {
#过期12小时,静态文件不怎么更新,过期可以设大一点,
expires 12h;
}
#PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.
location ~ ^.+\.php {
try_files $uri =404;
#fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9950;
# bakend 在 upstream.conf 文件中
fastcgi_pass bakend;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi.conf;
}
#禁止访问 .htxxx 文件
location ~ /.ht {
deny all;
}
#设定本虚拟主机的访问日志
access_log /www/wwwLogs/localhost.log access;
}
upstream.conf
内容如下
upstream bakend {
ip_hash;
server 127.0.0.1:9950 weight=1 max_fails=1 fail_timeout=0s;
#server 127.0.0.1:9951 weight=1 max_fails=1 fail_timeout=0s;
}