PHP/Nginx バージョン
php -v(php-fpm -v)
PHP 5.5.19 (cli) (built: Nov 16 2014 09:53:48)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
nginx -v
nginx version: nginx/1.6.2
さくらVPSでサーバを借りました。
PHP/Nginxをインストール・設定し、
サーバのIPにアクセスすると、404 Not Foundになってしまいます。
今回解決したいのは、IPにアクセスした時にドキュメントルートにあるindex.phpをみるようにしたのです。
ドキュメントルートは/var/wwwです。
nginxの設定は以下です。
/etc/nginx/conf.d/default.conf
lang
1server { 2 listen 80; 3 server_name localhost; 4 5 #charset koi8-r; 6 #access_log /var/log/nginx/log/host.access.log main; 7 8 location / { 9 # root /usr/share/nginx/html; 10 #root /var/www/; 11 root /var/www/; 12 index index.php index.html index.htm; 13 } 14 15 #error_page 404 /404.html; 16 17 # redirect server error pages to the static page /50x.html 18 # 19 error_page 500 502 503 504 /50x.html; 20 location = /50x.html { 21 #root /usr/share/nginx/html; 22 #root /var/www/; 23 root /var/www/; 24 } 25 26 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 27 # 28 #location ~ .php$ { 29 # proxy_pass http://127.0.0.1; 30 #} 31 32 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 33 # 34 location ~ .php$ { 35 # root html; 36 # root /usr/share/nginx/html; 37 root /var/www/; 38 #root $document_root; 39 fastcgi_pass 127.0.0.1:9000; 40 fastcgi_index index.php; 41 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 42 # fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; 43 fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; 44 include fastcgi_params; 45 } 46 47 # deny access to .htaccess files, if Apache's document root 48 # concurs with nginx's one 49 # 50 #location ~ /.ht { 51 # deny all; 52 #} 53} 54
設定後、nginx/phpは再起動しました。
何か解決策・アドバイス頂けますでしょうか?
宜しくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2014/12/17 17:33
2014/12/18 00:59