nginx安装

Posted wx614d70996f1e0

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx安装相关的知识,希望对你有一定的参考价值。

安装步骤

1.安装依赖软件

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

2.创建nginx启动用户

useradd -s /sbin/nologin nginx

3.编译

./configure --user=nginx --group=ngxinx --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre

编译说明

  --user  指定启动程序所属用户

--group  指定启动程序所属组

--prefix  指定Nginx程序的安装路径

--sbin-path  设置Nginx二进制文件的路径名

--conf-path  指定Nginx配置文件路径

--error-log-path  指定Nginx错误日志文件路径

--http-log-path  指定Nginx访问日志文件路径

--pid-path  设置Nginx的pid文件nginx.pid的路径

--lock-path  设置Nginx的lock文件nginx.lock文件路径

--with-openssl  指定OpenSSL源码包的路径,如果编译的时候没有指定“--with-openssl”选项,那么默认会使用系统自带的openssl库

--with-pcre  设置Nginx启用正则表达式

--with-http_stub_status_module  安装用来监控Nginx状态的模块

--with-http_ssl_module  表示启用Nginx的SSL模块,此模块依赖“--with-openssl”这个选项,通常一起使用。

--with-http_gzip_static_module  表示启用Nginx的gzip压缩

make && make install

模块

nginx安装_nginx


以上是关于nginx安装的主要内容,如果未能解决你的问题,请参考以下文章

如何使用yum安装nginx

想安装nginx,应该怎么做

nginx 编译安装详解

win7 怎样安装nginx?

windows下nginx安装配置后怎么使用

nginx安装和常见的配置