yum -y install make gcc gcc-c++ autoconf

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&ts=1419041744&use_mirror=softlayer-sng

mv pcre-8.36.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F pcre-8.36.tar.gz

groupadd www
useradd -g www www

yum repo for ngix

[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

tar zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install

cd nginx-1.7.8
yum -y install openssl*
./configure –user=www –group=www –prefix=/usr/local/web/nginx –with-http_stub_status_module –with-http_ssl_module
make && make install
cd /usr/local/web/nginx/conf/
cp nginx.conf nginx.conf.org
sed -i “s#\#gzip\ \ on;#\#gzip\ \ on;\n\n include\ \ vhosts/*.conf; #g” /usr/local/web/nginx/conf/nginx.conf

cat << EOF >> /usr/local/web/nginx/conf/vhosts/rmohan.com.conf

server

{

listen 80;

server_name rmohan.com;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host \$host;

proxy_set_header X-Real-IP \$remote_addr;

proxy_set_header REMOTE-HOST \$remote_addr;

proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan.com;

}

}

server

{

listen 8081;

server_name rmohan.com:8081;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host \$host;

proxy_set_header X-Real-IP \$remote_addr;

proxy_set_header REMOTE-HOST \$remote_addr;

proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan.com:8081;

}

}

EOF
ln -s /usr/local/lib/libpcre.so.1 /lib64/

ulimit -SHn 51200
/usr/local/web/nginx/sbin/nginx

/usr/local/web/nginx/conf?????ssl(????ssl??)

openssl genrsa -des3 -out rmohan.com.key 1024

openssl req -new -key rmohan.com.key -out rmohan.com.csr

cp rmohan.com.key rmohan.com.key.orgi

openssl rsa -in rmohan.com.key.orgi -out rmohan.com.key

openssl x509 -req -days 365 -in rmohan.com.csr -signkey rmohan.com.key -out rmohan.com.crt

2.?nginx.conf??????????????

include vhosts/rmohan.com.conf;

server {

listen 80;

server_name localhost;

location / {

root html;

index index.html index.htm;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

server {

listen 443 ssl;

server_name rmohan.com;

ssl on;

ssl_certificate ssl/rmohan.com.crt;

ssl_certificate_key ssl/rmohan.com.key;

keepalive_timeout 60;

ssl_protocols SSLv2 SSLv3 TLSv1;

ssl_prefer_server_ciphers on;

access_log /usr/local/web/nginx/logs/ssl-access.log;

error_log /usr/local/web/nginx/logs/ssl-error.log;

location / {

proxy_pass https://rmohan.com;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto https;

proxy_redirect off;

}

}

}

3.vhosts rmohan.conf

server

{

listen 80;

server_name rmohan.com;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header REMOTE-HOST $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan.com;

}

}

server

{

listen 8082;

server_name rmohan.com:8082;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header REMOTE-HOST $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan:8082;

}

}

Leave a comment

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*

Protected by WP Anti Spam

Hit Counter provided by dental implants orange county