nginx的编译安装

 后端   大苹果   2024-03-25 23:34   197

nginx下载

依赖安装

yum install zlib zlib-devel openssl openssl-devel pcre-devel -y

编译选项

./configure     \
--prefix=/usr/local/nginx     \
--sbin-path=/usr/local/nginx/sbin/nginx     \
--conf-path=/usr/local/nginx/conf/nginx.conf     \
--pid-path=/usr/local/nginx/nginx.pid     \
--with-http_ssl_module     \
--with-zlib=     \
--error-log-path=/usr/local/nginx/error/error.log  \   
--http-log-path=/usr/local/nginx/error/http.log     \
--user=www     \
--group=root     \
--lock-path=/var/lock/nginx.lock     \
--with-http_ssl_module     \
--with-http_flv_module     \
--with-http_stub_status_module     \
--with-http_gzip_static_module     \
--http-client-body-temp-path=/var/tmp/nginx/client/     \
--http-proxy-temp-path=/var/tmp/nginx/proxy/     \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/     \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi    \ 
--http-scgi-temp-path=/var/tmp/nginx/scgi     \
--with-stream

安装

make && make install

创建用户组和用户

groupadd www
useradd www -g www -d /home/www

检查配置文件及启动

/usr/local/nginx/sbin/nginx -t

/usr/local/nginx/sbin/nginx 

# 重启
/usr/local/nginx/sbin/nginx -s reload