Linux之nginx服务

作业一:nginx服务

1.二进制安装nginx包

2.作为web服务修改配置文件

3.让配置生效,验证配置

 

[root@localhost ~]# yum -y install epel-release

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# ls

bbb  CentOS-Base.repo  epel.repo  epel-testing.repo

[root@localhost yum.repos.d]# yum install nginx –y

 

配置验证

 [root@localhost yum.repos.d]# vim /etc/nginx/nginx.conf

server {

        listen       80 default_server;

        listen       [::]:80 default_server;

        server_name  _;

        root         /usr/share/nginx/html;

              }

 

# Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;

 

location / {root /var/www/html;

 

 [root@localhost yum.repos.d]# vim systemctl reloadb nginx

 [root@localhost html]# mkdir -p /var/www/html/

 [root@localhost html]# touch /var/www/html/index.html

 [root@localhost html]# echo "123" > /var/www/html/index.html

验证成功

 

posted @ 2017-03-21 00:04  qianxiamo  阅读(118)  评论(0编辑  收藏  举报