[[email protected] conf]# egrep -v "^$|#" nginx.conf.default >nginx.conf
[[email protected] conf]# pwd
/application/nginx/conf
[[email protected] conf]# vim nginx.conf 1 worker_processes 1; 2 events { 3 worker_connections 1024; 4 } 5 http { 6 include mime.types; 7 default_type application/octet-stream; 8 sendfile on; 9 keepalive_timeout 65; 10 server { 11 listen 80; 12 server_name localhost; 13 location / { 14 root html; 15 index index.html index.htm; 16 } 17 error_page 500 502 503 504 /50x.html; 18 location = /50x.html { 19 root html; 20 } 21 } 22 }
把第12行修改为如下:
12 server_name www.etiantian.org;
优雅重启/application/nginx/sbin/nginx -s reload
[[email protected] 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 [[email protected] conf]# /application/nginx/sbin/nginx -s reload
[[email protected] conf]# cd /application/nginx/html/ [[email protected] html]# ls 50x.html index.html [[email protected] html]# rm -f index.html
编辑index.html文件,输入如下内容:
[[email protected] html]# vim index.html
<html> <head> <title>老男孩教育运维28期</title> </head> <body> 28期最牛 <table border=1> <tr> <td>学号</td> <td>姓名</td> </tr> <tr> <td>01</td> <td>力哥</td> </tr> <tr> <td>02</td> <td>亮哥</td> </tr> </table> <a href="http://blog.oldboyedu.com"target=_balcnk><img src="gongli.jpg"冰冰美女</a> </body> </html>
然后再到当前目录上传一张gongli.jpg的图片(图片在下面附件中)。rz -y回车上传
</html>[[email protected] html]# pwd /application/nginx/html [[email protected] html]# ls 50x.html gongli.jpg index.html
最后打开windows ie输入地址http://10.0.0.8/ 即可打开网址。首页站点部署成功。
打开windows C:\Windows\System32\drivers\etc\hosts文件添加本地DNS解析
10.0.0.8 www.etiantian.org
cmd 中ping www.etiantian.org查看解析是不是10.0.0.8ip地址,如果是直接在ie中打开网址www.etiantian.org即可。
C:\Users\Administrator>ping www.etiantian.org 正在 Ping www.etiantian.org [10.0.0.8] 具有 32 字节的数据: 来自 10.0.0.8 的回复: 字节=32 时间<1ms TTL=64 来自 10.0.0.8 的回复: 字节=32 时间<1ms TTL=64 来自 10.0.0.8 的回复: 字节=32 时间<1ms TTL=64 来自 10.0.0.8 的回复: 字节=32 时间<1ms TTL=64 10.0.0.8 的 Ping 统计信息: 数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失), 往返行程的估计时间(以毫秒为单位): 最短 = 0ms,最长 = 0ms,平均 = 0ms
时间: 2024-10-25 22:11:39