Nginx 是一个独立的软件。
它是一款高性能的 Web 服务器、反向代理服务器和负载均衡器等,具有强大的功能和广泛的应用场景。它通常需要单独进行安装和配置来发挥其作用。
下载网址:http://nginx.org/en/download.html
nginx.conf写法:
java
#配置权重
upstream byeng{
server 192.168.31.25:8585 weight=1;
server 192.168.31.25:8586 weight=1;
}
upstream bya{
server 192.168.31.25:8585 weight=1;
server 192.168.31.25:8586 weight=1;
}
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
#此处nginx是跳上面upstream byeng权重
proxy_pass http://byeng;
}
#byeng后面加/,http后面有端口端口后面也要加/
location /byeng/ {
proxy_pass http://192.168.31.25:8585/;
}
#也可以这样写
location /a/ {
proxy_pass http://bya/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
java
upstream bya{
server 192.168.31.25:8585 weight=1;
server 192.168.31.25:8586 weight=1;
}
server{
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
#也可以这样写
location /a/ {
proxy_pass http://bya/;
}
}
其实Linux和window配置是一样的