前兩天開了個aws免費一年的EC2,我就想買個網域名稱搭個自己的部落格練練手。前期都很順利,可是在綁定網域名稱的時候遇到了麻煩,訪問網站時靈時不靈,日誌裡也看不到不出什麼問題。折騰一天了也沒什麼進展,求各位大神救救俺。下面是nginx.conf的內容,我還沒有配虛擬機器主機。
user www;worker_processes 1;error_log /opt/modules/nginx/logs/error.log notice;#error_log logs/error.log notice;#error_log logs/error.log info;pid /opt/modules/nginx/logs/nginx.pid;events { use epoll; worker_connections 1024;}http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /opt/modules/nginx/logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80 default; #charset koi8-r; access_log /opt/modules/nginx/logs/access.log main; location / { root html; index index.php index.html index.htm; } #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 html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } }}
日誌裡沒有列印錯誤,我這裡貼下瀏覽器報錯吧:
這個錯誤詭異在日誌沒有任何的報錯,而且不同的瀏覽器訪問網站情況還不一樣。我用chrome訪問的時候大概有十分之一的幾率訪問正常,用Safari的時候卻有百分之50的幾率訪問正常,用IE壓根不能正常訪問。網站地址是:http://gaochao.info
如果訪問正常的話會顯示nginx歡迎介面。大家也可以試試。期初我懷疑是網域名稱沒能夠正常解析,但後來我排除了這個可能。原因有兩點:第一我試過直接修改hosts檔案,問題沒有任何改善。第二我在ping網域名稱的時候:
這裡顯示網域名稱已經被成功解析到我的ip了。所以應該不是解析的問題。我已經試了各種方法了,還是沒能解決這個問題。懇請各位大神救我脫離苦海啊!!!
回複內容:
前兩天開了個aws免費一年的EC2,我就想買個網域名稱搭個自己的部落格練練手。前期都很順利,可是在綁定網域名稱的時候遇到了麻煩,訪問網站時靈時不靈,日誌裡也看不到不出什麼問題。折騰一天了也沒什麼進展,求各位大神救救俺。下面是nginx.conf的內容,我還沒有配虛擬機器主機。
user www;worker_processes 1;error_log /opt/modules/nginx/logs/error.log notice;#error_log logs/error.log notice;#error_log logs/error.log info;pid /opt/modules/nginx/logs/nginx.pid;events { use epoll; worker_connections 1024;}http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /opt/modules/nginx/logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80 default; #charset koi8-r; access_log /opt/modules/nginx/logs/access.log main; location / { root html; index index.php index.html index.htm; } #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 html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } }}
日誌裡沒有列印錯誤,我這裡貼下瀏覽器報錯吧:
這個錯誤詭異在日誌沒有任何的報錯,而且不同的瀏覽器訪問網站情況還不一樣。我用chrome訪問的時候大概有十分之一的幾率訪問正常,用Safari的時候卻有百分之50的幾率訪問正常,用IE壓根不能正常訪問。網站地址是:http://gaochao.info
如果訪問正常的話會顯示nginx歡迎介面。大家也可以試試。期初我懷疑是網域名稱沒能夠正常解析,但後來我排除了這個可能。原因有兩點:第一我試過直接修改hosts檔案,問題沒有任何改善。第二我在ping網域名稱的時候:
這裡顯示網域名稱已經被成功解析到我的ip了。所以應該不是解析的問題。我已經試了各種方法了,還是沒能解決這個問題。懇請各位大神救我脫離苦海啊!!!
其實看到串連被重設,99%就是被牆了!
AWS被牆了,你需要用代理才能訪問。
-
我在東京, 使用chrome和safari均可以正常訪問http://gaochao.info和http://52.196.247.234/
-
我使用IP Location查了一下你的IP(52.196.247.234), 地址在日本東京。我覺得網站間歇性抽風大概是因為被牆了...
-
換用國內雲端服務吧。或者使用Hexo搭建部落格, 部署到Coding上, 完全免費, 且非常方便。
被牆了,翻牆可以訪問。