Sunday, May 15, 2011

faster than original cpanel

i use nginx as cpanel wrapper.

server {
error_log /var/log/nginx/vhost-error_log warn;
# Use alternative port eg: port 2073
listen _PUBLIC_IP_:2073;

ssl on;


# redirect error page ssl
# this prevent nginx error 400 http://nginx.org/pipermail/nginx/2009-August/014521.html

error_page 497 https://$host$request_uri;

#ssl on; this can be turned off since the above will automatically enable it
ssl_certificate /etc/ssl/certs/domain.pem;
ssl_certificate_key /etc/ssl/private/domain.key;

server_name domain.com www.domain.com;
access_log /usr/local/apache/domlogs/domain.com-bytes_log bytes_log;
access_log /usr/local/apache/domlogs/domain.com combined;
root /home/smartcha/public_html;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 7d;
try_files $uri @backend;
#try_files $uri @redirSSL;
}
error_page 405 = @backend;

add_header X-Cache "HIT from Backend";
proxy_pass https://_PUBLIC_IP_:2083;
include proxy.inc;
}
#try n error by apis
#location @redirSSL {
#proxy_connect_timeout 15;
#proxy_redirect off;
#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;
#}
location @backend {
internal;
proxy_pass https://_PUBLIC_IP_:2083;
include proxy.inc;
proxy_set_header X-Forwarded-Proto https;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass https://_PUBLIC_IP_:2083;
include proxy.inc;
}
location ~ /\.ht {
deny all;
}
}

now you can access http://domain.com:2073

2 comments:

Anonymous said...

My neighbor and I were just debating this particular topic, he's usually in search of to prove me incorrect. Your view on this is nice and precisely how I really feel. I just now mailed him this web page to show him your personal view. After trying over your web site I ebook marked and might be coming again to learn your new posts!

Anonymous said...

well worth the read. I found it very informative as I have been researching a lot lately on practical matters such as you talk about…

Related Posts Plugin for WordPress, Blogger...