tar -zxvf tengine-2.1.0.tar.gz
cd tengine-2.1.0
1.安装依赖
yum -y install gcc openssl-devel pcre-devel zlib-devel
2.执行脚本
./configure \
--prefix=/opt/soft/tengine-2.1.0/ \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid\
--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-pcre
3.安装
make && make install
加到启动服务里面
将nginx启动脚本文件放到/etc/init.d/ 目录下。
改该配置文件:
vim nginx
主要改:
1.执行路径
ginx=
2.配置路径
_CONF_FILE=
给nginx文件加执行权限:
chmod 755 nginx
(chmod a+x nginx)
4.启动
service nginx start
(若结果报了异常,则需要考虑是怎么上传的nginx文件呢?文件编码格式不对,解决方法:
不能将Windows下的文件,直接用xftp工具拖到Linux该路径下,
需要vim 或者touch 该文件。
必须是在/etc/init.d、下面touch或者vi来新建
不能用xftp传进去,否则文件不被识别
)
(mkdir -p /var/tmp/nginx/client/
service nginx start)
默认http 80端口
5.将该文件加到系统服务
chkconfig --add nginx
(开机启动 chkconfig nginx on)
查看是否添加成功:
chkconfig --list nginx
启动,停止,重新装载
service nginx start|stop|reload
/etc/init.d/ 目录下都是一些注册的启动服务。nginx启动脚本。
cd /etc/init.d/