随笔 - 547  文章 - 1  评论 - 292  阅读 - 33万

nginx安装

安装依赖,安装前准备
yum install gcc
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel

下载解压安装包
//创建一个文件夹
cd /usr/local
mkdir nginx
cd nginx
//下载tar包
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -xvf nginx-1.13.7.tar.gz

安装nginx
//进入nginx目录
cd /usr/local/nginx
//执行命令
./configure
//执行make命令
make
//执行make install命令
make install


# //测试配置文件
[root@VM-4-3-centos nginx]# ./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

# nginx启动命令
[root@VM-4-3-centos sbin]# ./nginx
# nginx停止命令 或者 : nginx -s quit
[root@VM-4-3-centos sbin]# ./nginx -s stop
[root@VM-4-3-centos sbin]# ps -ef | grep nginx
root 26194 22309 0 15:44 pts/0 00:00:00 grep --color=auto nginx

如果是已经停止服务了,是不可以重启的。只有在正常运行的情况下,才可以reload重启。
# 重启命令
[root@VM-4-3-centos sbin]# ./nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
[root@VM-4-3-centos sbin]# ./nginx
# 查看进程命令
[root@VM-4-3-centos sbin]# ps -ef | grep nginx
root 26291 1 0 15:44 ? 00:00:00 nginx: master process ./nginx
nobody 26292 26291 0 15:44 ? 00:00:00 nginx: worker process
root 26309 22309 0 15:44 pts/0 00:00:00 grep --color=auto nginx
[root@VM-4-3-centos sbin]# ./nginx -s reload
[root@VM-4-3-centos sbin]# ps -ef | grep nginx
root 26291 1 0 15:44 ? 00:00:00 nginx: master process ./nginx
nobody 26396 26291 0 15:45 ? 00:00:00 nginx: worker process
root 26411 22309 0 15:45 pts/0 00:00:00 grep --color=auto nginx

# 测试访问
[root@VM-4-3-centos conf]# curl http://127.0.0.1:80

posted on   oktokeep  阅读(29)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示