首先 在阿里云设置二级域名
打开/usr/loacl/nginx/conf下的nginx.conf文件
添加红色框里的这句代码
在conf.d文件夹下增加自己的配置文件
配置文件的内容
server {
listen 80;
server_name load.ljhyyds.top;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
proxy_pass http://127.0.0.1:8081/show;
index index.html index.htm;
}
}
重启nginx
在sbin目录下运行./nginx -s reload
负载均衡配置
upstream myserver {
server 208.208.128.122:8081 weight=10; # 在这儿
server 208.208.128.122:8082 weight=10;
}
server {
listen 80;
server_name 208.208.128.122;
location / {
root html;
proxy_pass http://myserver;
index index.html index.htm;
}