Nginx配置啟動本地項目
Nginx (engine x) 是一個高性能的HTTP和反向代理web服務器,同時也提供了IMAP/POP3/SMTP服務。是一款輕量級的Web 服務器/反向代理服務器及電子郵件(IMAP/POP3)代理服務器,在BSD-like 協議下發行。其特點是占有內存少,並發能力強,事實上nginx的並發能力在同類型的網頁服務器中表現較好。
1、打開conf文件夾,修改nginx.conf
worker_processes 2; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; underscores_in_headers on; #gzip on; server { listen 9001; server_name 192.168.1.129; sendfile on; keepalive_timeout 999; client_header_timeout 999; client_body_timeout 999; send_timeout 999; proxy_connect_timeout 200; proxy_read_timeout 200; reset_timedout_connection on; charset utf-8; location ^~/api { proxy_pass http://192.168.1.129:89; } location ~* \.(gif|png|jpg|jpeg|css|js|html|ico|woff){ root C:/DNH/XM/ch_dist; } } server { listen 9002; server_name 192.168.1.129; sendfile on; keepalive_timeout 999; client_header_timeout 999; client_body_timeout 999; send_timeout 999; proxy_connect_timeout 200; proxy_read_timeout 200; reset_timedout_connection on; charset utf-8; location ^~/api { proxy_pass http://192.168.1.129:9528; } location ~* \.(gif|png|jpg|jpeg|css|js|html|ico|woff){ root C:/DNH/XM/gh_dist; } } }
2、啟動nginx
3、打開瀏覽器,訪問地址:192.168.1.129:9001