服务器安装LNMP环境,或者单独安装nginx。
两种方式添加软负载服务
1.nginx.conf添加
server {
listen 80;
server_name localhost;
autoindex on;
#charset koi8-r;
#access_log logs/host.access.log main;
root "C:/WWW";
location / {
root html;
index index.html index.htm index.php;
autoindex on;
} //后添加
server {
listen 80;
server_name www.daocheng.shop;
charset utf-8;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Nginx-Proxy true;
proxy_pass http://47.94.151.217:8888;
}
}
2.vhost目录下新建conf文件
server{
listen 80;
server_name www.doscen.com;
index index.html;
root /usr/tomcat/tomcat80/webapps/geenskyweb;
}