我配置nginx的服務於我們的服務器,有兩種VIRTUA主機:主主機和子域的主機。主要的主機是一個鐵路應用程序,與乘客一起服務。它按預期工作。nginx的禁止和壞網關錯誤
子域主機是一個小小的PHP應用程序。對這個子域做一個瀏覽器請求,它返回一個403(禁止)的錯誤。當對特定文件執行瀏覽器請求時,它將返回502(錯誤網關)錯誤。
這裏是nginx.conf文件:
#user nobody;
worker_processes 3;
events {
worker_connections 19000;
}
worker_rlimit_nofile 20000;
http {
include mime.types;
default_type application/octet-stream;
passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18;
passenger_ruby /usr/local/bin/ruby;
sendfile on;
gzip on;
gzip_http_version 1.1;
gzip_disable "msie6";
gzip_vary on;
gzip_comp_level 9;
gzip_static on;
passenger_max_pool_size 6;
passenger_min_instances 1;
passenger_pool_idle_time 10;
# Rails app
server {
listen 80;
server_name .domain.com;
passenger_enabled on;
root /home/ubuntu/rails_app/public;
location ~ ^/assets/ {
expires max;
add_header Cache-Control public;
#add_header Last-Modified "";
#add_header ETag "";
open_file_cache max=1000 inactive=500s;
open_file_cache_valid 600s;
open_file_cache_errors on;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# PHP app
server {
listen 80;
server_name sub.domain.com;
root /home/ubuntu/rails_app/sendy;
index index.html index.htm index.php;
if (!-d $uri) {
set $rule_0 1$rule_0;
}
if (!-f $uri) {
set $rule_0 2$rule_0;
}
if ($rule_0 = "21") {
rewrite ^/([a-zA-Z0-9-]+)$ /$1.php last;
}
location/{
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
#root html;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
#fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /l {
rewrite ^/l/([a-zA-Z0-9/]+)$ /l.php?i=$1 last;
}
location /t {
rewrite ^/t/([a-zA-Z0-9/]+)$ /t.php?i=$1 last;
}
location /w {
rewrite ^/w/([a-zA-Z0-9/]+)$ /w.php?i=$1 last;
}
location /unsubscribe {
rewrite ^/unsubscribe/(.*)$ /unsubscribe.php?i=$1 last;
}
location /subscribe {
rewrite ^/subscribe/(.*)$ /subscribe.php?i=$1 break;
}
location ~ /\.ht {
deny all;
}
}
}
我認爲這是一個權限問題,但我將其更改爲744,755和777甚至和仍然得到同樣的錯誤。
任何想法?
什麼的'ps輔助輸出| grep「php」'?你的php-fpm是否正在運行,是否在你指定的套接字上監聽? –
這是輸出,米歇爾: '的ubuntu 1531 0.0 0.1 8104 928個PTS/0 S + 14:3 0:00的grep --color =自動PHP 根7256 0.0 0.5 60672 3212? SS 2012 0:09 PHP-FPM:主進程(/etc/php5/fpm/php-fpm.conf) ' – betacar