Nginx反向代理设置 从80端口转向其他端口
[root@localhost bin]# netstat -lnutp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1552/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1408/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1487/master tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 6389/java tcp 0 0 :::8009 :::* LISTEN 6389/java tcp 0 0 :::8080 :::* LISTEN 6389/java tcp 0 0 :::22 :::* LISTEN 1408/sshd tcp 0 0 ::1:25 :::* LISTEN 1487/master udp 0 0 0.0.0.0:68 0.0.0.0:* 6042/dhclient [root@localhost bin]# java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://127.0.0.1:8080; #root html; #index index.html index.htm; }
网上找的一个配置:
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name 127.0.0.1:8080; location / { proxy_pass http://127.0.0.1:8080; } } }
联系方式QQ:326528263 EMAIL:clnking@163.com 网名:bass 分享技术 突破难点 创新思维