2014-09-17 3 views
0

나는 컴퓨터가 실행 중이고, nginx를 실행하려고 시도하고있다. 내 메인 웹 사이트에서 두 개의 CName 하위 도메인을 가지고 있으며 그에 따라 설정 파일을 설정했지만 연결하려고하면 큰 "서버에 연결할 수 없음"오류가 발생합니다. 라우터를 세 번 점검했는데 포트 80이 열려 있습니다. 또한, 내 플렉스 서버가 잘 작동합니다. 문제를 해결할 수 있도록 문제가 어디에 있는지 어떻게 알 수 있습니까?Nginx 가상 호스트?

내 첫 번째 생각은 권한과 관련이있는 것일 수도 있습니다. 두 개의 개별 홈 디렉토리에 파일을 저장합니다. 어떤 권한을 설정해야 nginx가 사용자뿐만 아니라 사용자도 액세스 할 수 있습니까?

nginx version: nginx/1.6.1 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.6.1/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.6.1/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.6.1/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.6.1/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.6.1/debian/modules/ngx_http_substitutions_filter_module

"의 출력 sudo는 nginx를 -t/:/var에의

server { 
    listen 80; 
    server_name server.----.com; 
    root /home/admin/public_html; 
    index index.html index.htm; 
} 

server { 
    listen 80; 
    server_name minecraft.----.com; 
    root /home/minecraft/public_html; 
    index index.html index.htm; 
} 

모든/로그 /의 nginx는

curl 127.0.0.1curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

의 nginx의 -V 가져 얻는다 비어 etc/nginx/nginx.conf ": nginx: invalid option: "/etc/nginx/nginx.conf"

출력은 "sudo netstat -pant | "의

tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1511/cupsd
tcp 0 0 0.0.0.0:39423 0.0.0.0:* LISTEN 1501/Plex Plug-in [ tcp 0 0 0.0.0.0:1224 0.0.0.0:* LISTEN 1627/Plex DLNA Serv tcp 0 0 0.0.0.0:52718 0.0.0.0:* LISTEN 1757/Plex Plug-in [ tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 1309/X
tcp 0 0 0.0.0.0:32469 0.0.0.0:* LISTEN 1627/Plex DLNA Serv tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1143/dnsmasq
tcp 0 0 0.0.0.0:43094 0.0.0.0:* LISTEN 1671/Plex Plug-in [ tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 964/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1511/cupsd
tcp6 0 0 :::25565 :::* LISTEN 1495/java
tcp6 0 0 :::32400 :::* LISTEN 1282/Plex Media Ser tcp6 0 0 :::6000 :::* LISTEN 1309/X
tcp6 0 0 :::32401 :::* LISTEN 1282/Plex Media Ser tcp6 0 0 :::22 :::* LISTEN 964/sshd

출력"추신 -ef를 | 그렙 LISTEN 그렙의 nginx "의

root 4014 1 0 15:03 ? 00:00:00 nginx: master process nginx www-data 4015 4014 0 15:03 ? 00:00:00 nginx: worker process www-data 4016 4014 0 15:03 ? 00:00:00 nginx: worker process www-data 4017 4014 0 15:03 ? 00:00:00 nginx: worker process www-data 4018 4014 0 15:03 ? 00:00:00 nginx: worker process root 24441 1 0 14:07 ? 00:00:00 nginx: master process nginx www-data 24442 24441 0 14:07 ? 00:00:00 nginx: worker process www-data 24443 24441 0 14:07 ? 00:00:00 nginx: worker process www-data 24444 24441 0 14:07 ? 00:00:00 nginx: worker process www-data 24445 24441 0 14:07 ? 00:00:00 nginx: worker process admin 29159 28078 0 19:44 pts/1 00:00:00 grep --color=auto nginx

출력", "텔넷 127.0.0.1 80 :

Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused

/etc/nginx/nginx.conf :

user www-data; 
worker_processes 4; 
pid /run/nginx.pid; 

events { 
    worker_connections 768; 
    # multi_accept on; 
} 

http { 

    ## 
    # 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 error; 

    ## 
    # 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/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/*.conf; 
+0

Nginx가 실행 중입니까? 서버 자체에서 연결할 수 있습니까? 테스트 할 호스트 파일 항목을 설정하십시오. – Brad

+0

Nginx가 실행 중이지만 192.168.0.2 minecraft.isp.com으로 호스트를 설정 한 후 "curl : (7) minecraft.iss.com 포트 80에 연결하지 못했습니다 : 연결이 거부되었습니다"라는 메시지가 표시됨 –

+0

과 동일 127.0.0.1 minecraft.-JP.com –

답변

0

확인의 nginx 서비스 상태 및 방화벽을 설정합니다.

+0

"sudo 서비스 nginx 상태": "* nginx가 실행 중입니다. " –

+0

또한 방화벽 설정은 아직 이루어지지 않았으며 로컬 연결은 방화벽 내부에 있음을 의미해야합니다. –

0

이 오류를 먼저 해결할 수 있습니까 ??

nginx: invalid option: "/etc/nginx/nginx.conf" 

일부 줄이 제대로 끝나지 않았을 수 있습니다.

+0

아니, 모든 라인이 있어야합니다; 결국 변경된 것이없는 기본 설정이기도합니다. –

+0

nginx 오류는 무엇이라고 말합니까? /var/log/nginx/error.log (예를 들어). 마지막 몇 줄은 사이트 설정에 "포함"설정이기 때문에 먼저이 오류를 수정해야합니다. 그렇지 않으면 nginx가 실행되지 않습니다. 위의 netstat 출력을 기반으로 80은 nginx에서 아직 열지 않습니다. – dctw

+0

'2014/09/18 15:02:09 이외의 아무것도 없음 [emerg] 3744 # 0 : 몇 시간 전에 무언가에서 /etc/nginx/nginx.conf : 1'에있는 알려지지 않은 지시문 "uqser" 오류가 발생할 수 있습니다 ... –