阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
时间:2017-04-20 02:22 来源:linux.it.net.cn 作者:IT
1、安装nginx
yum -y install nginx
2、启动nginx
service nginx start
3、访问(nginx默认是80端口)
curl 127.0.0.1
4、域名子绑定
编辑文件/etc/nginx/conf.d/default.conf,在底部加入下面代码,完成前几章所述4个端口的子域名绑定
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
server{
listen 80;
server_name tomcat.bingzhenmifan.com;
location /
{
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:14802;
}
}
server{
listen 80;
server_name jetty.bingzhenmifan.com;
location /
{
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:14808;
}
}
server{
listen 80;
server_name resin8080.bingzhenmifan.com;
location /
{
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:8080;
}
}
server{
listen 80;
server_name resin14805.bingzhenmifan.com;
location /
{
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:14805;
}
}
5、重启nginx
service nginx restart
6、访问测试
依次访问上面4个域名:tomcat.bingzhenmifan.com、jetty.bingzhenmifan.com、resin8080.bingzhenmifan.com、resin14805.bingzhenmifan.com
注意:如果域名没有备案的话,在本地是打不开网站的,可以在云服务器上使用curl命令访问
7、域名备案
登录阿里云,点击右上角【备案】,按步骤完成备案即可
(责任编辑:IT)
1、安装nginx yum -y install nginx 2、启动nginx service nginx start 3、访问(nginx默认是80端口) curl 127.0.0.1 4、域名子绑定 编辑文件/etc/nginx/conf.d/default.conf,在底部加入下面代码,完成前几章所述4个端口的子域名绑定
5、重启nginx service nginx restart 6、访问测试 依次访问上面4个域名:tomcat.bingzhenmifan.com、jetty.bingzhenmifan.com、resin8080.bingzhenmifan.com、resin14805.bingzhenmifan.com 注意:如果域名没有备案的话,在本地是打不开网站的,可以在云服务器上使用curl命令访问 7、域名备案 登录阿里云,点击右上角【备案】,按步骤完成备案即可 (责任编辑:IT) |