Nginx 静态服务器
生产环境是2台,我这测试就一台。动静分离:
nginx_static server:192.168.121.128
nginx_server :192.168.121.133
静态文件服务器配置:
1
2
3
4
5
6
7
8
9
# cat static.conf
server {
listen 80 default_server;#default_server
server_name_;#ip访问
location /{
root /data/company/;#静态文件存放的目录
indexindex.html index.htm;
}
}
#nginx_static映射的目录文件存放路径
1
2
3
4
5
6
# ls /data/company/
aboutUs.html img messageCloud.htmlnews-solution.html priceCloud.html solutionO2O.html
bak index.html min-system.html news-trends.html privateCloud.html trackCloud.html
companyWebsite-20170111.zipITservice.htmlnewDetail.html operationPerson.html solutionB2B2C.htmlWMS.html
css joinUS.html news operationsCourse.htmlsolutionB2B.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
# cat upstream.conf
upstream company {
server 192.168.121.128:80;
}
# cat zabbix.test.conf
server {
listen 80;
server_namezabbix.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;
}
}
效果图:
生产域名的话,在万网做个解析就好了!
页:
[1]