Created
November 3, 2012 18:23
-
-
Save solar/4008181 to your computer and use it in GitHub Desktop.
install nginx from source code with GeoIP module (with supervisord)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/zsh | |
# epel | |
curl -sLO http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-7.noarch.rpm | |
sudo rpm -ivh epel-release-6-7.noarch.rpm | |
rm epel-release-6-7.noarch.rpm | |
# edit /etc/yum.repod.d/epel.repo to set enable=0 | |
# install GeoIP-devel | |
sudo yum --enablerepo=epel -y install GeoIP-devel | |
# install nginx | |
prefix=/usr/local/nginx/1.2.4 | |
confpath=/etc/nginx/nginx.conf | |
errorlogpath=/var/log/nginx/error.log | |
httplogpath=/var/log/nginx/access.log | |
pidpath=/var/run/nginx/nginx.pid | |
lockpath=/var/run/nginx/nginx.lock | |
user=nginx | |
group=nginx | |
configure_opts=( | |
$configure_opts | |
--prefix=$prefix | |
--conf-path=/etc/nginx/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/run/nginx/nginx.lock | |
--user=nginx | |
--group=nginx | |
--with-http_geoip_module | |
--with-http_realip_module | |
--without-http_charset_module | |
--without-http_ssi_module | |
--without-http_userid_module | |
--without-http_split_clients_module | |
--without-http_scgi_module | |
--without-http_memcached_module | |
--without-http_limit_conn_module | |
--without-http_limit_req_module | |
--without-http_empty_gif_module | |
--without-mail_pop3_module | |
--without-mail_imap_module | |
--without-mail_smtp_module | |
) | |
curl -sL http://nginx.org/download/nginx-1.2.4.tar.gz | tar zx | |
cd ./nginx-1.2.4 | |
./configure $configure_opts | |
make | |
sudo make install | |
sudo su -c 'echo "daemon off;" >> /etc/nginx/nginx.conf' | |
cd ../ | |
sudo rm -rf ./nginx-1.2.4 | |
sudo alternatives --install /usr/local/sbin/nginx nginx $prefix/sbin/nginx 10204 | |
sudo mkdir -p /etc/supervisord.d | |
sudo cp ./supervisord.d/nginx.ini /etc/supervisord.d/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:nginx] | |
command=/usr/local/sbin/nginx | |
autostart=true | |
autorestart=true | |
user=root | |
priority=400 | |
redirect_stderr=true | |
stdout_logfile=/var/log/nginx/stdout.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment