一位老司机 发表于 2025-4-19 14:31:53

统信UOS/Centos nginx安装

详细内容参考:https://www.cnblogs.com/neco/p/6143130.html
下载好nginx安装包 解压在/usr/local 下面


进入目录 cd /nginx-1.10.2
执行以下命令
1…/configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf
2.make
3.make install
可能会出现下面的错误
src/core/ngx_murmurhash.c: In function ‘ngx_murmur_hash2’:
src/core/ngx_murmurhash.c:37:11: error:this statement may fall through [-Werror=implicit-fallthrough=]
         h ^= data<<16;~~^~~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: note: here
   case2:^~~~
src/core/ngx_murmurhash.c:39:11: error:this statement may fall through [-Werror=implicit-fallthrough=]
         h ^= data<<8;~~^~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: note: here
   case1:^~~~解决
/nginx-1.10.2/objs/Makefile,去掉CFLAGS中的-Werror,再重新make目前只遇到上面一个问题:
安装成功后,会出现一个nginx 文件代表安装成功


**
最后:

**
启动nginx
cd /usr/local/nginx-1.10.2/sbin
./nginx
进入localhost:80
可能出现的问题
1.nginx访问报错403 is forbidden
解决:
查看/usr/local/nginx-1.10.2/error.log日志显示:xxx 403 forbidden (13: Permission denied)错误
详细参考https://blog.csdn.net/reblue520/article/details/52294555
我的做法是:把nginx的启动用户改成目录的所属用户
打开nginx配置文件:
加上user root;就ok了

2.错误信息:
nginx: could not open error log file: open() “/usr/local/nginx/logs/error.log” failed (2: No such file or directory)
2016/09/13 19:08:56 6996#0: open() “/usr/local/nginx/logs/access.log” failed (2: No such file or directory)
原因分析:nginx/目录下没有logs文件夹
自己创建一个logs目录就ok了
mkdir logs
chmod 700 logs其他命令提供
#查询nginx主进程号
ps -ef | grep nginx
#停止进程
kill -QUIT 主进程号(我的是27854)
#快速停止
kill -TERM 主进程号(我的是2993)
#强制停止
pkill -9 nginx
页: [1]
查看完整版本: 统信UOS/Centos nginx安装