对本身进行nginx服务器搭建的步骤进行总结,省得本身往后给忘记了
html
1.首先你要去下载nginx包。这个本身去百度 下载地址http://nginx.org/en/download.htmlnginx
2.解压nginx包浏览器
3. 配置(因为nginx是c语言写的,因此你就要这么进行操做) bash
./configure \服务器
--prefix=/usr/local/nginx \ui
--pid-path=/var/run/nginx/nginx.pid \spa
--lock-path=/var/lock/nginx.lock \.net
--error-log-path=/var/log/nginx/error.log \code
--http-log-path=/var/log/nginx/access.log \orm
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
你把这个粘贴完,80%会遇到错误
下面对错误进行总结
①
yum install -y zlib-devel
② 缺失openssl
wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
tar zxvf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config --prefix=/usr/local/openssl
make && make install
③ 缺失 prce
yum install pcre
查看pcre的安装路径
[root@localhost /]# rpm -qa pcre
这样弄完基本就不错出问题了.而后重复第3步骤
4.建立 nginx临时目录 mkdir -p /var/temp/nginx (建立这个是由于我在configure中这么配置的)
5.make
6.make install
7.进入nginx安装目录去启动它 cd /usr/local/nginx/sbin (为何是这个目录,configurea这么配置的)
执行命令 ./nginx
看到这个进行,你的nginx就安装完毕了,而后用浏览器去访问它(nginx默认访问端口是80)
注意下:必定要关闭防火墙 service iptables stop (不然可能访问失败)