码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 安装Nginx详细步骤

时间:2020-06-12 14:50:45      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:sof   download   led   inux   没有   block   class   linux 安装   evel   

1. 下载nginx http://nginx.org/download/nginx-1.18.0.tar.gz 并将下载的压缩包scp到指定服务器

2.选定安装目录 ,下载安装依赖

cd /usr/loca/src

yum install gcc

yum install pcre-devel

yum install zlib zlib-devel

yum install openssl openssl-devel

3. 安装nginx  

cd /usrl/local 

解压nginx包

cd /nginx

执行配置 ./configure --with-http_ssl_module

编译安装 make && make install

4. 启动 进入sbin 目录 然后执行 ./nginx

报错:nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory) 2020/06/03 16:13:36 [emerg] 24173#0: open() "/usr/local/nginx/logs/access.log" failed (2: No such file or directory)

原来是没有找到日志目录,解决方法 新建logs目录。再次启动 ./nginx

默认端口是80 访问到,则说明安装启动成功。

Wellcome to nginx! 

5. 其他nginx命令

./nginx -t 检测配置文件

./nginx -s reload 重启

./nginx -s stop 关闭nginx

ps -ef | grep nginx 查看nginx 进程

kill -HUP [Nginx主进程号(即ps命令查到的PID)] 平滑重启

Linux 安装Nginx详细步骤

标签:sof   download   led   inux   没有   block   class   linux 安装   evel   

原文地址:https://www.cnblogs.com/bfyq/p/13098886.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!