nginx 安装

参考安装指南:http://nginx.org/en/docs/configure.html

1.下载最新主线(mainline)代码nginx-1.7.6到/usr/local目录下解压

   /usr/local$ tar -zxvf nginx-1.7.6.tar.gz

2.进入/usr/local/nginx-1.7.6/目录下

 /usr/local/nginx-1.7.6# ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.34 --with-zlib=../zlib-1.2.8

/usr/local/nginx-1.7.6# make & make test

/usr/local/nginx-1.7.6# make & make install

3. 进入/usr/local/nginx目录下,执行./nginx,然后用ps aux 查看是有有master和worker进程,如果有表示安装正确

4. nginx -t检查nginx的配置文件是否正确

 注:

--prefix=指定nginx安装路径,这里安装到/usr/local/nginx目录下

--sbin-path=指定生成的可执行文件名字,这里生成的可执行文件时/usr/local/nginx/nginx文件

--conf-path=指定nginx的nginx.conf文件的别名,这里仍使用nginx.conf文件。nginx启动的时候可以通过-c选项指定不同的启动配置文件

--pid-path=指定nginx.pid文件的别名,用来存储主进程(master进程)的pid号

--with-http_ssl_module=使nginx服务器支持HTTPS协议服务。默认安装是不支持的,需要openssl库的支持

--with-pcre=配置文件里 location指令和ngx_http_rewrite_module会用到的正则表达式支持库

--with-zlib=ngx_http_gzip_module会用到的库

原文地址:https://www.cnblogs.com/buxianghe/p/4012139.html