Home | Mirror | Search |
$ sudo apt-get install nginx
sudo /etc/init.d/nginx start
http://nginx.org/packages/centos/$releasever/$basearch/
$releasever 是版本號
$basearch 處理器架構
http://nginx.org/packages/centos/6/x86_64/
cat > /etc/yum.repos.d/nginx.repo <<EOF [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/x86_64/ gpgcheck=0 enabled=1 EOF
i386
cat > /etc/yum.repos.d/nginx.repo <<EOF [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/5/i386/ gpgcheck=0 enabled=1 EOF
yum search nginx ============================================= Matched: nginx ============================================= nginx.x86_64 : high performance web server yum install -y nginx chkconfig nginx on service nginx start
cd /usr/local/src/ wget http://www.nginx.org/download/nginx-1.0.6.tar.gz ./configure --prefix=/usr/local/server/nginx \ --with-openssl=/usr/include \ --with-pcre=/usr/include/pcre/ \ --with-http_stub_status_module \ --without-http_memcached_module \ --without-http_fastcgi_module \ --without-http_rewrite_module \ --without-http_map_module \ --without-http_geo_module \ --without-http_autoindex_module
rpm 所使用的編譯參數
nginx -V nginx: nginx version: nginx/1.0.6 nginx: built by gcc 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) nginx: TLS SNI support enabled nginx: configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx --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.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwcgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6
# nginx -V nginx version: nginx/1.2.3 built by gcc 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) TLS SNI support enabled configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx --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.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g'
# cat /srv/bin/rotatelog.sh #!/bin/bash # run this script at 0:00 #Nginx Log Path log_dir="/var/log/nginx" date_dir=`date +%Y/%m/%d/%H` mkdir -p ${log_dir}/${date_dir} > /dev/null 2>&1 mv ${log_dir}/access.log ${log_dir}/${date_dir}/access.log mv ${log_dir}/error.log ${log_dir}/${date_dir}/error.log kill -USR1 `cat /var/run/nginx.pid` gzip ${log_dir}/${date_dir}/access.log & gzip ${log_dir}/${date_dir}/error.log &