安装Nginx
1、环境准备
2、创建nginx用户
3、安装pcre-8.33.tar.gz
4、安装nginx-1.5.4.tar.gz
6、开机自启动
安装Nginx
1、环境准备
系统:Centos6.4最小安装+开发工具包
Nginx所需要的库:pcre
由于一般需要同时安装PHP所以最好使用yum一键安装所有依赖库文件:
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2、创建nginx用户
# useradd nginx -M -s /sbin/nologin
3、安装pcre-8.33.tar.gz
下载地址:http://sourceforge.net/projects/pcre
# ./configure --prefix=/usr/local/pcre
# make && make install
4、安装nginx-1.5.4.tar.gz
# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre=/soft/pcre-8.33
# make && make install
/*注-with-pcre=/soft/pcre-8.33为源码包解压的路径*/
6、开机自启动
# echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local