Nginx学习历程_1_Nginx提供Web服务

1.提供测页面

1
2
3
4
5
6
7
8
[root@web nginx] # mkdir -pv /data/www 
mkdir : 已创建目录  "/data/www" 
[root@web nginx] # cd /data/www 
[root@web www] # ll 
总用量 0
[root@web www] # cat index.html
<h1>www.nginx.org< /h1 >
[root@web www] # chown -R nginx.nginx /data/www/*

2.备份配置文件

1
2
3
4
5
6
[root@web ~] # cd /etc/nginx/ 
[root@web nginx] # cp nginx.conf nginx.conf.bak 
[root@web nginx] # ls 
fastcgi.conf          fastcgi_params.default  mime.types          nginx.conf.bak      scgi_params.default   win-utf 
fastcgi.conf.default  koi-utf                 mime.types.default  nginx.conf.default  uwsgi_params 
fastcgi_params        koi-win                 nginx.conf          scgi_params         uwsgi_param

3.修改配置文件

1
2
3
4
5
6
7
8
9
10
[root@web www] # vim /etc/nginx/nginx.conf
server { 
       listen       80; 
       server_name  localhost;
       #charset koi8-r;
       #access_log  logs/host.access.log  main;
       location / { 
           root    /data/www
           index  index.html index.htm; 
       }

4.重新加载nginx配置

1
2
3
4
[root@web run] # service nginx reload
nginx: the configuration  file  /etc/nginx/nginx .conf syntax is ok
nginx: configuration  file  /etc/nginx/nginx .conf  test  is successful
重新载入 nginx:                                           [确定]
5.测试一下

http://localhost/ 访问index.html页面

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值