nginx 启动php示例
server {
listen 80;
server_name xxx.localhost;
root /usr/local/var/www/xxxx;
location / {
autoindex on;
index index.html index.htm index.php;
}
location ~ \.php$ {
#root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
}
if ( !-e $request_filename ){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
}
nginx开启反向代理的例子
server {
listen 80;
server_name xxx.localhost;
root /usr/local/var/www/xxxx;
location / {
autoindex on;
index index.html index.htm;
}
location /api {
rewrite /api/?(.*)$ /$1 break;
include uwsgi_params;
proxy_pass http://xxxx.com;
}
#if ( !-e $request_filename ){
# rewrite ^/(.*)$ /index.php?s=/$1 last;
#}
}
网友评论