Use is the native Ubuntu nginx do Web server, but the previous period of time has been good, suddenly can not connect localhost, check a lot of data also no solution.
The Nginx service is enabled as follows:
$ sudo service nginx status * nginx is running
/etc/nginx/nginx.confIs the default is not moved, one of which is include also, as follows:
### Virtual Host Configs##include /etc/nginx/conf.d/*.conf;include /etc/nginx/sites-enabled/*;
/etc/nginx/site-availableThe default in, as follows:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # With php5-cgi alone: fastcgi_pass 127.0.0.1:9000; # With php5-fpm: # kfastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one}
Then visit localhost as follows:
How is it solved?
127.0.0.1 also cannot access or open an agent.
Reply content:
Use is the native Ubuntu nginx do Web server, but the previous period of time has been good, suddenly can not connect localhost, check a lot of data also no solution.
The Nginx service is enabled as follows:
$ sudo service nginx status * nginx is running
/etc/nginx/nginx.confIs the default is not moved, one of which is include also, as follows:
### Virtual Host Configs##include /etc/nginx/conf.d/*.conf;include /etc/nginx/sites-enabled/*;
/etc/nginx/site-availableThe default in, as follows:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # With php5-cgi alone: fastcgi_pass 127.0.0.1:9000; # With php5-fpm: # kfastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one}
Then visit localhost as follows:
How is it solved?
127.0.0.1 also cannot access or open an agent.
Nginxubuntuunder the schema differs from centos or, the windows usual nginx all-site configuration is placed in the /etc/nginx/site-availabl directory, but note that this is only a usable configuration, if you want to open the configuration of the MO-site such as ( www.test.com ), you need to /etc/nginx/site-enabled create软连接
$ pwd/etc/nginx/site-enabled$ sudo ln -s /etc/nginx/site-availabl/www.test.com www.test.com
Soft connect created well after Chongqing NG ,
Find out if there's 127.0.0.1 locahost.
No, No.
# echo "127.0.0.1 locahost" >> /etc/hosts
Solved, but not quite understood;
I site-available default copied a copy of the file into/etc/nginx/conf.d/default.conf
And then
sudo nginx -tsudo service nginx restart
You can do it. Is it /etc/nginx/conf.d /etc/nginx/site-available OK to write the configuration file in any directory with them?
Is it a firewall setup problem?