centos 7.5 安装nginx

2020-04-02  本文已影响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;
 }
}
上一篇 下一篇

猜你喜欢

热点阅读