2012-03-03 3 views
0

를 받고 여기 내 nginx를 구성이다 : -실험 셋업 - 403

user http; 
worker_processes 1; 

events { 
    worker_connections 1024; 
} 


http { 
    include  mime.types; 
    default_type application/octet-stream; 

    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
         '$status $body_bytes_sent "$http_referer" ' 
         '"$http_user_agent" "$http_x_forwarded_for"'; 

    # main access log 
    access_log /var/log/nginx_access.log main; 

    # main error log 
    error_log /var/log/nginx_error.log debug; 

    # My django main site 
    server { 
     listen 80; 
     server_name mysite.com; 
     # no security problem here, since/is alway passed to upstream 
     root /var/git/mysite_live; 
     # serve directly - analogous for static/staticfiles 
     location /static { 
      alias /var/git/mysite_live/public/static; 
     } 
     location /media { 
      alias /var/git/mysite_live/public/media; 
     } 
     location/{ 
      proxy_pass_header Server; 
      proxy_set_header Host $http_host; 
      proxy_redirect off; 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header X-Scheme $scheme; 
      proxy_connect_timeout 10; 
      proxy_read_timeout 10; 
      proxy_pass http://localhost:8000/; 
     } 
     # what to serve if upstream is not available or crashes 
     error_page 500 502 503 504 /media/50x.html; 
    } 

    # My wordpress blog, on a subdomain 
    server { 
     listen  80;     # our server's public IP address:port 
     server_name blog.mysite.com;  # our domain name 
     root   /srv/http/wordpress/; # absolute path to your WordPress installation 

     try_files $uri $uri/ /index.php; 

     location ~ \.php$ { 
      include  fastcgi_params; 
      fastcgi_pass localhost:9000; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     } 

    } 

} 

내가 PHP-FPM 설치하고 내 아치 리눅스 서버에 rc.d start php-fpm를 실행 해가 잘 작동 .

나는이 역방향 프록시 설정에서/srv/http/wordpress에있는 내 wordpress 사이트를 제공해야하는 PHP-fpm 서버를 사용하지 못하도록하는 것이 누락 되었습니까? 내가 blog.mysite.com 내 nginx를 오류 로그에 액세스 할 때

나는 403 금지 오류가 발생하고, 같은 오류가 표시됩니다 :

2012/03/03 05:09:30 [error] 26414#0: *7 directory index of "/srv/http/wordpress/" is forbidden, client: 133.235.39.138, server: blog.mysite.com, request: "GET/HTTP/1.1", host: "blog.mysite.com" 

답변

2

변경 :

try_files $uri $uri/ /index.php; 

하는 방법 :

try_files $uri /index.php; 
+0

그래. 그게 효과가 있었어. :-) –