2013-07-08 62 views
0

我最近在舊PC上設置了一個Web服務器。我安裝了centOS,mySQL,PHP和Nginx。當我配置Nginx並啓動了Web服務器時,我無法使用IP地址從同一臺路由器或路由器外部的PC進行連接。我已經設置了端口轉發我使用這樣Nginx可以自己ping,但無法從其他地方連接

規則的TP-LINK路由器1
應用HTTP_SERVER
協議的所有
起始端口80
結束端口80
本地IP地址192.168.1.101

我/etc/nginx/conf.d/default.conf文件有

server { 
listen    80 default_server; 
server_name   server.com; 

charset koi8-r; 

location/{ 
    root   /usr/share/nginx/html; 
    index   index.html index.htm index.php; 
} 

error_page   404   /404.html; 
location = /404.html { 
    root   /usr/share/nginx/html; 
} 

error_page   500 502 503 504 /50x.html; 
location = /50x.html { 
    root   /usr/share/nginx/html; 
} 

location ~ \.php$ { 
    root   /usr/share/nginx/html; 
    fastcgi_pass 127.0.0.1:9000; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    include   fastcgi_params; 
} 
} 

我沒有經驗與Linux和Nginx的少,我真的很感謝任何人可以給的幫助。在此先感謝

回答

0

其設置爲默認在CentOS未允許通過添加線

-A INPUT -p TCP --dport 80 -j ACCEPT

端口80上連接的防火牆 - A輸入-p根據tcp --dport 443 -j ACCEPT

的文件

的/ etc/SYSCONFIG/iptables的

的/ etc/SYSCONFIG/ip6tables

允許HTTP和HTTPS連接到我的服務器

0

要使用IP地址的IP添加到服務器名稱

server_name server.com 192.168.1.101; 

然後重啓nginx的連接,如果你從本地網絡內部訪問http://192.168.1.101它應該工作。

+0

感謝您的答覆穆罕默德,我試過,但同樣的結果。我認爲它可能是路由器,我最近遇到了問題,並更新了固件,因爲速度已經升高或降低,可能端口轉發不起作用 – johnnty

+0

'server.com'工作也是如此或不 ? –

+0

不工作對不起 – johnnty

相關問題