2014-05-20 2 views
1

나는 nginx에 매우 익숙하다.모든 페이지에 'Welcome to nginx!'가 표시됩니다.

나는 경로에있는 사이트가 있습니다 /var/www/sourcesage을하고 ngnix.conf은 다음과 같습니다 :

UPDATE :

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로 사이트에 액세스하려고 (http://198.x.x.x/) ,하지만 어떤 페이지 나 "nginx에 오신 것을 환영합니다!"메시지를 표시하려고 액세스하려고했습니다.

이 메시지를 없애는 방법.

답변

7

기본 구성을 사용하여 포함되는 .conf 파일을 조정하거나 제거하여 Nginx 설치를 구성해야합니다. 경로에서 참조 된 파일을 살펴 보자

include /etc/nginx/conf.d/*.conf; 
include /etc/nginx/sites-enabled/*; 

을 당신은 Nginx에 대한 요청을 라우팅하는 방법을 구성하는 적어도 하나 개의 server 블록을 볼 수 있습니다; 이것이 환영 메시지를 보는 이유입니다.

이러한 파일 중 하나에는 root 지시문이 포함되어 있으며 다른 표준 구성 중 정적 파일을 처음부터 제공 할 위치를 구성합니다. 설치를 구성하는 방법을 알아 보려면 Nginx documentation을 살펴 봐야합니다. Nginx 설치를 구성하는 방법은 정적 페이지 대 동적 컨텐트 또는 웹 응용 프로그램과 같이 사용자가 제공하는 서비스와 서비스 제공 방법에 전적으로 의존합니다.

+0

내가 편집 한 것을 볼 수 있습니까? 'server'블록을 추가 할 수 있습니까? – n92

+0

http://192.xxx를 열고 해당 파일 – n92

+1

을 다운로드 할 수 있습니다. 다른 사람이 찾고있는 경우에 대비하여 "server_name" example.com "줄은 세미콜론 :"server_name example.com; "과 함께 입력하십시오. – ZN13

관련 문제