|
生产环境是2台,我这测试就一台。
动静分离:
nginx_static server:192.168.121.128
nginx_server :192.168.121.133
静态文件服务器配置:
1
2
3
4
5
6
7
8
9
| [iyunv@192 conf.d]# cat static.conf
server {
listen 80 default_server; #default_server
server_name _;#ip访问
location /{
root /data/company/;#静态文件存放的目录
index index.html index.htm;
}
}
|
#nginx_static映射的目录文件存放路径
1
2
3
4
5
6
| [iyunv@192 conf.d]# ls /data/company/
aboutUs.html img messageCloud.html news-solution.html priceCloud.html solutionO2O.html
bak index.html min-system.html news-trends.html privateCloud.html trackCloud.html
companyWebsite-20170111.zip ITservice.html newDetail.html operationPerson.html solutionB2B2C.html WMS.html
css joinUS.html news operationsCourse.html solutionB2B.html
fonts js news.html operationSystem.html solutionB2C.html
|
nginx服务器代理:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| [iyunv@localhost conf.d]# cat upstream.conf
upstream company {
server 192.168.121.128:80;
}
[iyunv@localhost conf.d]# cat zabbix.test.conf
server {
listen 80;
server_name zabbix.test.com;
location / {
index index.html;
proxy_pass http://company;#upstream
proxy_set_header Host $host; #nginx主机头
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
|
效果图:
生产域名的话,在万网做个解析就好了!
|
|
|
|
|
|
|