Linux 显示';欢迎来到nginx';
我对nginx很陌生 我在路径中有一个站点:Linux 显示';欢迎来到nginx';,linux,nginx,Linux,Nginx,我对nginx很陌生 我在路径中有一个站点:/var/www/sourcesage,ngnix.conf如下: 更新: user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { server { listen 80; ## listen for ipv4; this
/var/www/sourcesage
,ngnix.conf如下:
更新:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
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/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
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:
fastcgi_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
#
location ~ /\.ht {
deny all;
}
}
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
#include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
我试图通过服务器IP()访问该站点,但我试图访问的任何页面都会显示一条消息“欢迎使用nginx!”
如何删除此消息。您需要通过调整或删除使用基本配置包含的
.conf
文件来配置Nginx安装。查看路径中引用的文件:
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
您将看到至少一个服务器
块,用于配置如何路由到Nginx的请求;这就是您看到欢迎信息的原因
其中一个文件将包含一个
root
指令,该指令配置从何处开始提供静态文件,以及其他标准配置。您应该查看以了解如何配置安装。如何配置Nginx安装将完全取决于您所提供的服务以及您需要如何提供服务,例如静态页面与动态内容或web应用程序。您需要通过调整或删除使用基本配置包含的.conf
文件来配置Nginx安装。查看路径中引用的文件:
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
您将看到至少一个服务器
块,用于配置如何路由到Nginx的请求;这就是您看到欢迎信息的原因
其中一个文件将包含一个
root
指令,该指令配置从何处开始提供静态文件,以及其他标准配置。您应该查看以了解如何配置安装。如何配置Nginx安装将完全取决于您提供的服务以及您需要如何提供服务,例如静态页面与动态内容或web应用程序。请查看我的编辑,我添加了“服务器”块,以防其他人看到:同时确保您已结束“server\u name example.com”用分号换行:“server\u name example.com;”。请看我的编辑,我已经添加了“server”块,以防其他人查看:还要确保“server\u name example.com”行以分号结尾:“server\u name example.com;”。