Zac*_*urt 6 nginx reverse-proxy wordpress
为什么http://compassionpit.com/blog/经历无限重定向循环?这是我的 nginx conf 文件。该站点由端口 8000 上的 nodejs 服务器运行,Apache 提供博客 (wordpress) 和论坛 (phpBB)。论坛解决得很好,在http://www.compassionpit.com/forum/ ...
server {
listen 80;
server_name www.compassionpit.org;
rewrite ^/(.*) http://www.compassionpit.com/$1 permanent;
}
server {
listen 80; # your server's public IP address
server_name www.compassionpit.com;
index index.php index.html;
location ~ ^/$ {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location @blogphp {
internal;
root /opt/blog/;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8080;
}
location ~ ^/(forum|blog)/($|.*\.php) {
root /opt/;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8080;
}
location ~ ^/(forum|blog) {
root /opt/;
try_files $uri $uri/ @blogphp;
}
location ~ ^/(forum|blog)/ {
root /opt/;
}
location @backend {
internal;
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ / {
root /opt/chat/static/;
try_files $uri $uri/ @backend;
}
}
Run Code Online (Sandbox Code Playgroud)
小智 0
Nginx 可能正在继续处理其他 if 语句。在 if 语句末尾添加“break”
location ~ ^/(forum|blog)/($|.*\.php) {
root /opt/;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8080;
break;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3861 次 |
| 最近记录: |