centos 7.5 安装nginx

安装依赖

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;
 }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容