修改Nginx的配置文件,在Nginx安裝目錄中的conf文件夾中
打開nginx.conf
找到http塊中的server塊 如圖
修改server_name 後面的內容爲服務器外網IP
在location塊中root和index中間添加一個proxy_pass 後面的內容爲要轉發的地址,我這裏Tomcat端口號是8888
然後在windows中測試直接訪問IP,出現Tomcat界面。
修改Nginx的配置文件,在Nginx安裝目錄中的conf文件夾中
打開nginx.conf
找到http塊中的server塊 如圖
修改server_name 後面的內容爲服務器外網IP
在location塊中root和index中間添加一個proxy_pass 後面的內容爲要轉發的地址,我這裏Tomcat端口號是8888
然後在windows中測試直接訪問IP,出現Tomcat界面。
server { listen 80; server_name localhost; charset utf8; #access_log logs/host.access.log main;