{"id":4085,"date":"2014-12-22T10:29:54","date_gmt":"2014-12-22T02:29:54","guid":{"rendered":"http:\/\/rmohan.com\/?p=4085"},"modified":"2014-12-22T10:31:46","modified_gmt":"2014-12-22T02:31:46","slug":"ngix-web","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4085","title":{"rendered":"Ngix web"},"content":{"rendered":"<p>yum -y install make gcc gcc-c++ autoconf<\/p>\n<p>wget http:\/\/downloads.sourceforge.net\/project\/pcre\/pcre\/8.36\/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&amp;ts=1419041744&amp;use_mirror=softlayer-sng<\/p>\n<p>mv pcre-8.36.tar.gz\\?r\\=http\\:%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F pcre-8.36.tar.gz<\/p>\n<p>groupadd www<br \/>\nuseradd -g www www<\/p>\n<p>yum repo for ngix<\/p>\n<p>[root@test1 software]# cat \/etc\/yum.repos.d\/ngix.repo<br \/>\n[nginx]<br \/>\nname=nginx repo<br \/>\nbaseurl=http:\/\/nginx.org\/packages\/centos\/6\/$basearch\/<br \/>\ngpgcheck=0<br \/>\nenabled=1<br \/>\n[root@test1 software]# yum install nginx<br \/>\nwget http:\/\/nginx.org\/download\/nginx-1.7.8.tar.gz<\/p>\n<p>tar zxvf pcre-8.36.tar.gz<br \/>\ncd pcre-8.36<br \/>\n.\/configure<br \/>\nmake &amp;&amp; make install<\/p>\n<p>cd nginx-1.7.8<br \/>\nyum -y install openssl*<br \/>\n.\/configure &#8211;user=www &#8211;group=www &#8211;prefix=\/usr\/local\/web\/nginx &#8211;with-http_stub_status_module &#8211;with-http_ssl_module<br \/>\nmake &amp;&amp; make install<br \/>\ncd \/usr\/local\/web\/nginx\/conf\/<br \/>\ncp nginx.conf nginx.conf.org<br \/>\nsed -i &#8220;s#\\#gzip\\ \\ on;#\\#gzip\\ \\ on;\\n\\n include\\ \\ vhosts\/*.conf; #g&#8221; \/usr\/local\/web\/nginx\/conf\/nginx.conf<\/p>\n<p>cat &lt;&lt; EOF &gt;&gt; \/usr\/local\/web\/nginx\/conf\/vhosts\/rmohan.com.conf<\/p>\n<p>server<\/p>\n<p>{<\/p>\n<p>listen 80;<\/p>\n<p>server_name rmohan.com;<\/p>\n<p>charset GB2312;<\/p>\n<p>index index.html index.htm;<\/p>\n<p>root \/var\/www\/html\/rmohan.com\/;<\/p>\n<p>location ~ ^\/NginxStatus\/ {<\/p>\n<p>stub_status on;<\/p>\n<p>access_log off;<\/p>\n<p>}<\/p>\n<p>location \/ {<\/p>\n<p>proxy_redirect off ;<\/p>\n<p>proxy_set_header Host \\$host;<\/p>\n<p>proxy_set_header X-Real-IP \\$remote_addr;<\/p>\n<p>proxy_set_header REMOTE-HOST \\$remote_addr;<\/p>\n<p>proxy_set_header X-Forwarded-For \\$proxy_add_x_forwarded_for;<\/p>\n<p>client_max_body_size 50m;<\/p>\n<p>client_body_buffer_size 256k;<\/p>\n<p>proxy_connect_timeout 30;<\/p>\n<p>proxy_send_timeout 30;<\/p>\n<p>proxy_read_timeout 60;<\/p>\n<p>proxy_buffer_size 256k;<\/p>\n<p>proxy_buffers 4 256k;<\/p>\n<p>proxy_busy_buffers_size 256k;<\/p>\n<p>proxy_temp_file_write_size 256k;<\/p>\n<p>proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;<\/p>\n<p>proxy_max_temp_file_size 128m;<\/p>\n<p>proxy_pass http:\/\/rmohan.com;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>server<\/p>\n<p>{<\/p>\n<p>listen 8081;<\/p>\n<p>server_name rmohan.com:8081;<\/p>\n<p>charset GB2312;<\/p>\n<p>index index.html index.htm;<\/p>\n<p>root \/var\/www\/html\/rmohan.com\/;<\/p>\n<p>location ~ ^\/NginxStatus\/ {<\/p>\n<p>stub_status on;<\/p>\n<p>access_log off;<\/p>\n<p>}<\/p>\n<p>location \/ {<\/p>\n<p>proxy_redirect off ;<\/p>\n<p>proxy_set_header Host \\$host;<\/p>\n<p>proxy_set_header X-Real-IP \\$remote_addr;<\/p>\n<p>proxy_set_header REMOTE-HOST \\$remote_addr;<\/p>\n<p>proxy_set_header X-Forwarded-For \\$proxy_add_x_forwarded_for;<\/p>\n<p>client_max_body_size 50m;<\/p>\n<p>client_body_buffer_size 256k;<\/p>\n<p>proxy_connect_timeout 30;<\/p>\n<p>proxy_send_timeout 30;<\/p>\n<p>proxy_read_timeout 60;<\/p>\n<p>proxy_buffer_size 256k;<\/p>\n<p>proxy_buffers 4 256k;<\/p>\n<p>proxy_busy_buffers_size 256k;<\/p>\n<p>proxy_temp_file_write_size 256k;<\/p>\n<p>proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;<\/p>\n<p>proxy_max_temp_file_size 128m;<\/p>\n<p>proxy_pass http:\/\/rmohan.com:8081;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>EOF<br \/>\nln -s \/usr\/local\/lib\/libpcre.so.1 \/lib64\/<\/p>\n<p>ulimit -SHn 51200<br \/>\n\/usr\/local\/web\/nginx\/sbin\/nginx<\/p>\n<p>\/usr\/local\/web\/nginx\/conf?????ssl(????ssl??)<\/p>\n<p>openssl genrsa -des3 -out rmohan.com.key 1024<\/p>\n<p>openssl req -new -key rmohan.com.key -out rmohan.com.csr<\/p>\n<p>cp rmohan.com.key rmohan.com.key.orgi<\/p>\n<p>openssl rsa -in rmohan.com.key.orgi -out rmohan.com.key<\/p>\n<p>openssl x509 -req -days 365 -in rmohan.com.csr -signkey rmohan.com.key -out rmohan.com.crt<\/p>\n<p>2.?nginx.conf??????????????<\/p>\n<p>include vhosts\/rmohan.com.conf;<\/p>\n<p>server {<\/p>\n<p>listen 80;<\/p>\n<p>server_name localhost;<\/p>\n<p>location \/ {<\/p>\n<p>root html;<\/p>\n<p>index index.html index.htm;<\/p>\n<p>}<\/p>\n<p>error_page 500 502 503 504 \/50x.html;<\/p>\n<p>location = \/50x.html {<\/p>\n<p>root html;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>server {<\/p>\n<p>listen 443 ssl;<\/p>\n<p>server_name rmohan.com;<\/p>\n<p>ssl on;<\/p>\n<p>ssl_certificate ssl\/rmohan.com.crt;<\/p>\n<p>ssl_certificate_key ssl\/rmohan.com.key;<\/p>\n<p>keepalive_timeout 60;<\/p>\n<p>ssl_protocols SSLv2 SSLv3 TLSv1;<\/p>\n<p>ssl_prefer_server_ciphers on;<\/p>\n<p>access_log \/usr\/local\/web\/nginx\/logs\/ssl-access.log;<\/p>\n<p>error_log \/usr\/local\/web\/nginx\/logs\/ssl-error.log;<\/p>\n<p>location \/ {<\/p>\n<p>proxy_pass https:\/\/rmohan.com;<\/p>\n<p>proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;<\/p>\n<p>proxy_set_header Host $host;<\/p>\n<p>proxy_set_header X-Real-IP $remote_addr;<\/p>\n<p>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n<p>proxy_set_header X-Forwarded-Proto https;<\/p>\n<p>proxy_redirect off;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>3.vhosts rmohan.conf<\/p>\n<p>server<\/p>\n<p>{<\/p>\n<p>listen 80;<\/p>\n<p>server_name rmohan.com;<\/p>\n<p>charset GB2312;<\/p>\n<p>index index.html index.htm;<\/p>\n<p>root \/var\/www\/html\/rmohan.com\/;<\/p>\n<p>location ~ ^\/NginxStatus\/ {<\/p>\n<p>stub_status on;<\/p>\n<p>access_log off;<\/p>\n<p>}<\/p>\n<p>location \/ {<\/p>\n<p>proxy_redirect off ;<\/p>\n<p>proxy_set_header Host $host;<\/p>\n<p>proxy_set_header X-Real-IP $remote_addr;<\/p>\n<p>proxy_set_header REMOTE-HOST $remote_addr;<\/p>\n<p>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n<p>client_max_body_size 50m;<\/p>\n<p>client_body_buffer_size 256k;<\/p>\n<p>proxy_connect_timeout 30;<\/p>\n<p>proxy_send_timeout 30;<\/p>\n<p>proxy_read_timeout 60;<\/p>\n<p>proxy_buffer_size 256k;<\/p>\n<p>proxy_buffers 4 256k;<\/p>\n<p>proxy_busy_buffers_size 256k;<\/p>\n<p>proxy_temp_file_write_size 256k;<\/p>\n<p>proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;<\/p>\n<p>proxy_max_temp_file_size 128m;<\/p>\n<p>proxy_pass http:\/\/rmohan.com;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>server<\/p>\n<p>{<\/p>\n<p>listen 8082;<\/p>\n<p>server_name rmohan.com:8082;<\/p>\n<p>charset GB2312;<\/p>\n<p>index index.html index.htm;<\/p>\n<p>root \/var\/www\/html\/rmohan.com\/;<\/p>\n<p>location ~ ^\/NginxStatus\/ {<\/p>\n<p>stub_status on;<\/p>\n<p>access_log off;<\/p>\n<p>}<\/p>\n<p>location \/ {<\/p>\n<p>proxy_redirect off ;<\/p>\n<p>proxy_set_header Host $host;<\/p>\n<p>proxy_set_header X-Real-IP $remote_addr;<\/p>\n<p>proxy_set_header REMOTE-HOST $remote_addr;<\/p>\n<p>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n<p>client_max_body_size 50m;<\/p>\n<p>client_body_buffer_size 256k;<\/p>\n<p>proxy_connect_timeout 30;<\/p>\n<p>proxy_send_timeout 30;<\/p>\n<p>proxy_read_timeout 60;<\/p>\n<p>proxy_buffer_size 256k;<\/p>\n<p>proxy_buffers 4 256k;<\/p>\n<p>proxy_busy_buffers_size 256k;<\/p>\n<p>proxy_temp_file_write_size 256k;<\/p>\n<p>proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;<\/p>\n<p>proxy_max_temp_file_size 128m;<\/p>\n<p>proxy_pass http:\/\/rmohan:8082;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>yum -y install make gcc gcc-c++ autoconf<\/p>\n<p>wget http:\/\/downloads.sourceforge.net\/project\/pcre\/pcre\/8.36\/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&amp;ts=1419041744&amp;use_mirror=softlayer-sng<\/p>\n<p>mv pcre-8.36.tar.gz\\?r\\=http\\:%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F pcre-8.36.tar.gz<\/p>\n<p>groupadd www useradd -g www www<\/p>\n<p>yum repo for ngix<\/p>\n<p>[root@test1 software]# cat \/etc\/yum.repos.d\/ngix.repo [nginx] name=nginx repo baseurl=http:\/\/nginx.org\/packages\/centos\/6\/$basearch\/ gpgcheck=0 enabled=1 [root@test1 software]# yum install nginx wget http:\/\/nginx.org\/download\/nginx-1.7.8.tar.gz<\/p>\n<p>tar zxvf pcre-8.36.tar.gz cd pcre-8.36 .\/configure make &amp;&amp; make install<\/p>\n<p>cd nginx-1.7.8 yum -y install openssl* [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4085"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4085"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4085\/revisions"}],"predecessor-version":[{"id":4086,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4085\/revisions\/4086"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}