赞
踩
yum install ruby rubygems ruby-devel rpm-build
[root@server ~]# gem sources
*** CURRENT SOURCES ***
https://rubygems.org/
[root@server ~]# gem sources -a http://mirrors.aliyun.com/rubygems/
http://mirrors.aliyun.com/rubygems/ added to sources
[root@server ~]# gem sources
*** CURRENT SOURCES ***
https://rubygems.org/
http://mirrors.aliyun.com/rubygems/
[root@server ~]# gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
[root@server ~]# gem sources
*** CURRENT SOURCES ***
http://mirrors.aliyun.com/rubygems
[root@server ~]# gem install fpm -v 1.3.3
Fetching: ffi-1.15.5.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Fetching: childprocess-4.1.0.gem (100%)
Successfully installed childprocess-4.1.0
Fetching: clamp-0.6.5.gem (100%)
Successfully installed clamp-0.6.5
Fetching: cabin-0.9.0.gem (100%)
Successfully installed cabin-0.9.0
Fetching: arr-pm-0.0.11.gem (100%)
Successfully installed arr-pm-0.0.11
Fetching: backports-3.23.0.gem (100%)
Successfully installed backports-3.23.0
Fetching: json-2.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-2.6.2
Fetching: fpm-1.3.3.gem (100%)
Successfully installed fpm-1.3.3
8 gems installed
yum install -y pcre-devel openssl-devel
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--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 \
--user=nginx \
--group=nginx \
--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
make && make DESTDIR=/opt/nginx install
[root@uplook system]# vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /var/run/nginx/nginx.pid
#ExecStartPre=/usr/sbin/nginx -t
ExecStartPre=/usr/bin/mkdir -p /var/tmp/nginx/
ExecStart=/usr/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/usr/sbin/nginx -s quit
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
[Install]
WantedBy=multi-user.target
fpm -s dir -t rpm -n nginx -v 1.22 -d 'pcre-devel,openssl-devel' --pre-install /tools/pre-nginx.sh --post-install /tools/post-nginx.sh -C /opt/nginx/ -f
[root@server tools]# cat pre-nginx.sh
#!/bin/bash
useradd -M -s /sbin/nologin nginx
mkdir -p /var/tmp/nginx/client/
[root@server tools]# cat post-nginx.sh
#!/bin/bash
cp -f /usr/local/nginx/nginx.service /usr/lib/systemd/system/nginx.service
rm -rf /usr/local/nginx/nginx.service
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。