CentOS7安装配置Nginx服务器

5 篇文章 0 订阅

nginx服务器:

(1)通过xftp工具从本地(Win10)上传到服务器(Centos7);
        本地目录下的nginx文件传到CentOS7下的/home/water/nginx/目录
        su root
        cd /home/water/nginx/
        ls

(2)解压文件
        tar -xvf nginx-1.10.3.tar.gz

(3)安装nginx
        cd /home/water/nginx/nginx-1.10.3
        ls
        // 执行命令
        ./configure
        // 执行make命令
        make
        // 执行make install命令
        make install

 (4)配置nginx.conf
        // 查看配置文件nginx.conf
        cat /usr/local/nginx/conf/nginx.conf
        // 修改配置文件nginx.conf
        vim /usr/local/nginx/conf/nginx.conf

        server {
        #监听端口
            listen       80;
        #指定网站域名
            server_name  localhost;

            #charset koi8-r;

            #access_log  logs/host.access.log  main;

            location / {
                root   html;
                index  index.html index.htm;
            }

(5)查看nginx进程是否启动:
        ps -ef | grep nginx

(6)启动nginx服务器
        // 进入目录
        cd /usr/local/nginx/sbin

        ./nginx 启动
        ./nginx -s stop 关闭
        ./nginx -s reload 重启 

 (7)再查看nginx进程是否启动:
        ps -ef | grep nginx
        
        root     10097     1  0 12:54 ?        00:00:00 nginx: master process ./nginx
        nobody   10098 10097  0 12:54 ?        00:00:00 nginx: worker process
        root     11117  9652  0 14:35 pts/1    00:00:00 grep --color=auto nginx

 (8)关闭CentOS7防火墙
        systemctl stop firewalld.service

 (9)访问服务器ip查看
        192.168.2.6
        
        Welcome to nginx!
        If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

        For online documentation and support please refer to nginx.org.
        Commercial support is available at nginx.com.

        Thank you for using nginx.
    成功

 

     
  

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值