美文网首页
centos 7.5 安装nginx

centos 7.5 安装nginx

作者: 茅坑里的小石头 | 来源:发表于2020-04-02 16:40 被阅读0次

    安装依赖

    yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
    

    安装nginx

    yum install nginx
    

    设置开机启动

    systemctl enable nginx.service
    

    启动

    systemctl start nginx.service
    

    重启

    systemctl restart nginx.service
    

    查看状态

    systemctl status nginx.service
    

    查看所有已启动的服务

    systemctl list-units --type=service
    

    安装位置/usr/local/nginx,配置文件位置为

    /usr/local/nginx/conf/nginx.conf
    

    编辑conf添加vhosts

    vim /usr/local/nginx/conf/nginx.conf
    

    在http{}中添加

    include vhosts/*.conf
    

    建立目录

    cd /usr/local/nginx/conf/
    mkdir vhosts
    

    建立网站配置文件

    vim www.test.com.conf
    

    内容为

    server {
     listen 80;
     server_name www.test.com;
     location / {
     root  /www/wwwroot/www.test.com;
     index  index.php;
     }
    }
    

    相关文章

      网友评论

          本文标题:centos 7.5 安装nginx

          本文链接:https://www.haomeiwen.com/subject/opgxphtx.html