2017-06-09 5 views
0

info.phpを含む私のサーバにPHPファイルをロードしようとすると、404エラーが表示されます。 LEMPを16.04でインストールしましたが、私のPHPが動作しない理由を見つけるのは難しいようです。16.04のインストールでLEMPの後にPHPを動作させるには? info.phpファイルでもエラー404が発生する

私のnginxのサイトで入手可能なファイルは次のようになります。

server { 
listen 80; 
listen [::]:80; 

server_name website.com www.website.com; 

location/{ 
     root /var/www/website.com/html; 
index index.html index.htm index.php index.nginx-debian.html; 
     try_files $uri $uri/ =404; 
} 

location ~ \.php$ { 
include snippets/fastcgi-php.conf; 
fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
} 

location ~ /\.ht { 
deny all; 


} 

} 

server { 
listen 443; 
ssl on; 
# sslcertificate 
sslcertificate /etc/nginx/certchain.crt; 
# sslcertificatekey 
sslcertificate_key /root/website.com.key; 

server_name website.com website.com; 
access_log /var/log/nginx/nginx.vhost.access.log; 
error_log /var/log/nginx/nginx.vhost.error.log; 
location/{ 

root /var/www/website.com/html; 
index index.php index.html index.htm index.nginx-debian.html; 

} 

location ~ .php$ { 
include snippets/fastcgi-php.conf; 
fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
} 

location ~ /\.ht { 
deny all; 


} 

} 

答えて

0

私が発見し、問題を解決し、私は、サーバー名の前に先頭にroot /var/www/website.com/html; index index.html index.htm index.php index.nginx-debian.html;を移動し、あなたは以下を参照することができますいくつかの他のコードを追加しました。

server { 
    listen 80; 
    listen [::]:80; 

    root /var/www/example.com/html; 
    index index.html index.htm index.php index.nginx-debian.html; 

    server_name example.com www.example.com; 

    location/{ 

    try_files $uri $uri/ =404; 
    } 

    error_page 404 /404.html; 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
      root /usr/share/nginx/html; 

    } 

    location ~ \.php$ { 
    include snippets/fastcgi-php.conf; 
    fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
    } 



    } 


    server { 
    listen 443; 
    ssl on; 
      # ssl_certificate 
      ssl_certificate /etc/nginx/cert_chain.crt; 
      # ssl_certificate_key 
      ssl_certificate_key /root/example.com.key; 

      root /var/www/example.com/html; 
    index index.html index.htm index.php index.nginx-debian.html; 

      server_name example.com www.example.com; 
      access_log /var/log/nginx/nginx.vhost.access.log; 
      error_log /var/log/nginx/nginx.vhost.error.log; 
    location/{ 
      try_files $uri $uri/ =404; 
    } 


    error_page 404 /404.html; 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
      root /usr/share/nginx/html; 

    } 

    location ~ \.php$ { 
    include snippets/fastcgi-php.conf; 
    fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
    } 



} 
関連する問題