admin管理员组文章数量:1794759
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 .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
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2022-06-03,如有侵权请联系 cloudcommunity@tencent 删除服务centosnginxroot测试本文标签: nginx安装
版权声明:本文标题:nginx安装 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1754986852a1709084.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论