centos6.6编译安装openresty,centos6.6openresty
centos6.6编译安装openresty,centos6.6openresty
需求:
Openresty
- 安装位置:/usr/local/openresty
- nginx日志 /data/www/logs
- 代码目录 /data/www/htdocs
安装依赖
yum install pcre-devel openssl-devel gcc curl
到openresty下载安装包1.13.6.1,放置于家目录下。
tar zxf openresty-1.13.6.1.tar.gz
cd openresty-1.13.6.1
./configure --prefix=/usr/local/openresty --with-debug \
--error-log-path=/data/www/logs/error_nginx.log \
--http-log-path=/data/www/logs/access_nginx.log \
--user=root --with-http_stub_status_module \
—with-http_ssl_module --with-http_gzip_static_module
gmake
gmake install
安装完成
安装后的步骤
Vim /etc/profile.d/openresty.sh
export PATH=/usr/local/openresty/nginx/sbin:$PATH
./etc/profile.d/openresty.sh
设定开机启动和指定service文件
呵呵呵,这里就复制一份别人的吧,把所有内容关于路径的地方修改为上述安装位置。
[root@bogon bin]# vim /etc/init.d/nginx
# processname: nginx
# config: /usr/local/openresty/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/openresty/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/openresty/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
就上面第15行修一下路径即可。
然后
chkconfig --add nginx
chkconfig nginx on
评论暂时关闭