nginx-普通用户

如果需要让nginx绑定1024以下端口,有两个方案,方法2是妥协之策。

1、用root安装并运行nginx。

2、用普通用户安装运行nginx,绑定高端口,通过配置路由转发,把低端口重定向到高端口。

普通用户安装nginx:

1、nginx下载地址:http://nginx.org/en/download.html

2、解压:tar -xvf nginx-1.21.0.tar.gz。

3、在安装路径(假设安装路径为/app/nginx)下手工建目录:sbin、log、conf、tmp、var。这些目录在下一步时需要用到

4、在解压目录下执行,如有其他特殊模块,需自行补充:

./configure --user=app  --group=app   --prefix=/app --sbin-path=/app/nginx/sbin/nginx  --conf-path=/app/nginx/conf/nginx.conf  --error-log-path=/app/nginx/log/error.log  --http-log-path=/app/nginx/log/access.log  --http-client-body-temp-path=/app/nginx/tmp/client_body  --http-proxy-temp-path=/app/nginx/tmp/proxy  --http-fastcgi-temp-path=/app/nginx/tmp/fastcgi  --pid-path=/app/nginx/var/run/nginx.pid  --lock-path=/app/nginx/var/lock/subsys/nginx  --with-http_stub_status_module  --with-http_ssl_module  --with-http_gzip_static_module

5、执行

make
make install

安装完成、修改配置,app用户通过执行/app/nginx/nginx来启动

原文地址:https://www.cnblogs.com/badwood316/p/14958218.html