实战:部署一个Web站点(适合新手)

[root@web01 ~]# cd /application/nginx/conf/ #进入nginx配置目录

[root@web01 conf]# diff nginx.conf nginx.conf.default #用diff比对发现conf下的所有文件都已经备份

[root@web01 conf]# egrep -v "^$|#" nginx.conf.default >nginx.conf #去除配置文件里面的$和#注释信息

[root@web01 conf]# vim nginx.conf #进入配置文件

        server_name  www.etiantian.org;  #在12行配置站点

[root@web01 conf]# /application/nginx/sbin/nginx -t #检查语法

nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok

nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful

[root@web01 conf]# /application/nginx/sbin/nginx -s reload #平滑重启

[root@web01 conf]# cd /application/nginx/html/

[root@web01 html]# rm -f index.html

[root@web01 html]#vim index.html

<html>

<head>

<title>ר1</title>

</head>

<body>

Ϊѧϰ

<table border=1>

<tr>

<td></td>

<td></td>

</tr>

<tr>

<td>001</td>

<td>1</td>

</tr>

<tr>

<td>002</td>

<td>2</td>

</tr>

</table>

<a href="https://blog.csdn.net/qq_41816540" target=_blank><img src="ceshi.jpg">ȷa>

</body>

</html>

###注:点击确认会跳转到https://blog.csdn.net/qq_41816540网页,<img src="ceshi.jpg”>插入的图片名,前题是图片已经上传到/application/nginx/html目录下

 

在客户端打开浏览器输入服务器端IP,查看效果

 

 

利用Windows系统解析服务器内容:

1. 运行-->drivers-->etc-->修改hosts文件-->10.0.0.8 www.etiantian.org #地址+域名(模拟局域网DNS)

2. 查看是否生效:运行-->cmd-->ping www.etiantian.org  #查看地址是否是10.0.0.8

3. 浏览器访问:www.etiantian.org

猜你喜欢

转载自blog.csdn.net/qq_41816540/article/details/80831342
今日推荐