2014-12-12 4 views
1

Я получаю ошибку File not found с nginx, и я пытался исправить это в течение нескольких часов. Конфигурация похожа на то, что я использую на других сайтах, но я не знаю, почему это происходит Файлы work.html работают нормально.Nginx + php-fpm дает файл не найден

btw Я посмотрел на это post, но все еще не мог найти, что не так с моей.

server { 
    listen 80; 
    server_name servergreek.com 167.88.125.157; 
    return 301 http://www.servergreek.com$request_uri; 
} 
server { 
    listen  80 default_server; 
    server_name www.servergreek.com; 
    access_log /home/servergreek.com/public_html/logs/access_log main; 
    error_log  /home/servergreek.com/public_html/logs/error_log crit; 
    root /home/servergreek.com/public_html/www; 
    index index.php index.html index.htm; 

    #Serve static content directly 
    location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|woff)$ { 
    access_log off; 
    expires max; 
    } 

    location ~ ^/tmp/(.*)$ { 
    deny all; 
    } 



    # Zend Opcache rules 
     #location /opcache/ { 
      # root /home/servergreek.com/public_html/www; 
      # index index.php index.html index.htm; 
      # auth_basic   "Restricted Area (Secured by Khavish)"; 
      # auth_basic_user_file /var/www/servergreek.com/private/htpasswd; 
     #} 

    # Only requests to our Host are allowed 
    if ($host !~ ^(servergreek.com|www.servergreek.com)$) { 
     return 444; 
     } 

    location ~* \.php$ { 
     root /home/servergreek.com/public_html/www; 
     fastcgi_pass unix:/tmp/php5-fpm.sock; 
     fastcgi_index index.php; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     include  fastcgi_params; 
     fastcgi_connect_timeout 60; 
     fastcgi_send_timeout 300; 
     fastcgi_read_timeout 300; 
     fastcgi_buffer_size 128k; 
     fastcgi_buffers 256 16k; 
     fastcgi_busy_buffers_size 256k; 

    } 

    #location ~ /\.ht { 
    # deny all; 
    #} 


     } 

index.php расположение /home/servergreek.com/public_html/www/index.php.Thanks за помощь мне

+0

Конфигурация выглядит хорошо. Имеет мало комментариев, но не критично. Не работает ли www.servergreek.com/ или www.servergreek.com/index.php? Существует /tmp/php5-fpm.sock? Nginx был перезапущен? –

+0

@Terra как servergreek.com/, так и servergreek.com/index.php показывают ту же ошибку и /tmp/php5-fpm.sock существует – user2650277

+0

Как выглядит «файл не найден»? Ошибка стандартного 404 с подписью nginx? Вы видите этот запрос в своем access_log? –

ответ

0

первый

chmod 0755 /home/servergreek.com/ 
chmod 0755 /home/servergreek.com/public_html/ 
chmod 0755 /home/servergreek.com/public_html/www 

secand добавить

location/{ 
      root /home/servergreek.com/public_html/www/; 
      index index.html index.htm index.php ; 
    } 
Смежные вопросы