Browse Source

Update apps.conf

lj2007331 9 years ago
parent
commit
8e8858fffb
13 changed files with 200 additions and 215 deletions
  1. 1 1
      README.md
  2. 2 2
      apps.conf
  3. 1 1
      config/drupal.conf
  4. 29 29
      config/ecshop.conf
  5. 1 1
      config/joomla.conf
  6. 63 63
      config/nginx.conf
  7. 67 82
      config/nginx_apache.conf
  8. 4 4
      config/opencart.conf
  9. 3 3
      config/typecho.conf
  10. 2 2
      config/wordpress.conf
  11. 1 1
      include/jemalloc.sh
  12. 1 1
      include/tcmalloc.sh
  13. 25 25
      vhost.sh

+ 1 - 1
README.md

@@ -5,7 +5,7 @@ Script properties:
 - Source compiler installation, most stable source is the latest version, and download from the official site
 - Some security optimization
 - Providing a plurality of database versions (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5)
-- Providing multiple PHP versions (php-5.3, php-5.4, php-5.5, php-5.6, php-7/phpng(Beta))
+- Providing multiple PHP versions (php-5.3, php-5.4, php-5.5, php-5.6, php-7/phpng(RC))
 - Provide Nginx, Tengine
 - Providing a plurality of Tomcat version (Tomcat-8, Tomcat-7)
 - Providing a plurality of JDK version (JDK-1.6, JDK-1.7, JDK-1.8)

+ 2 - 2
apps.conf

@@ -60,10 +60,10 @@ memcached_pecl_version=2.2.0
 memcache_pecl_version=2.2.7
 
 # phpMyadmin
-phpMyAdmin_version=4.4.13.1
+phpMyAdmin_version=4.4.14
 
 # jemalloc
-jemalloc_version=3.6.0
+jemalloc_version=4.0.0
 
 # tcmalloc
 tcmalloc_version=2.4

+ 1 - 1
config/drupal.conf

@@ -1,3 +1,3 @@
 if (!-e $request_filename) {
-      rewrite ^/(.*)$ /index.php?q=$1 last;
+    rewrite ^/(.*)$ /index.php?q=$1 last;
     }

+ 29 - 29
config/ecshop.conf

@@ -1,32 +1,32 @@
 if (!-e $request_filename)
 {
-rewrite "^/index\.html" /index.php last;
-rewrite "^/category$" /index.php last;
-rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last;
-rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last;
-rewrite "^/feed\.xml$" /feed.php last;
-rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
-rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
-rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
-rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last;
-rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last;
-rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last;
-rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last;
-rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
-rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last;
-rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last;
-rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last;
-rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
-rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last;
-rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last;
-rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last;
-rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last;
-rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last;
-rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last;
-rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last;
-rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last;
-rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
-rewrite "^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
-rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last;
-rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last;
+    rewrite "^/index\.html" /index.php last;
+    rewrite "^/category$" /index.php last;
+    rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last;
+    rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last;
+    rewrite "^/feed\.xml$" /feed.php last;
+    rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
+    rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
+    rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
+    rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last;
+    rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last;
+    rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last;
+    rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last;
+    rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
+    rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last;
+    rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last;
+    rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last;
+    rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
+    rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last;
+    rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last;
+    rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last;
+    rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last;
+    rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last;
+    rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last;
+    rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last;
+    rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last;
+    rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
+    rewrite "^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
+    rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last;
+    rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last;
 }

+ 1 - 1
config/joomla.conf

@@ -1,3 +1,3 @@
 location / {
-        try_files $uri $uri/ /index.php?$args;
+    try_files $uri $uri/ /index.php?$args;
 }

+ 63 - 63
config/nginx.conf

@@ -6,75 +6,75 @@ pid /var/run/nginx.pid;
 worker_rlimit_nofile 51200;
 
 events {
-	use epoll;
-	worker_connections 51200;
-	}
+    use epoll;
+    worker_connections 51200;
+    }
 
 http {
-	include mime.types;
-	default_type application/octet-stream;
-	server_names_hash_bucket_size 128;
-	client_header_buffer_size 32k;
-	large_client_header_buffers 4 32k;
-	client_max_body_size 50m;
-	sendfile on;
-	tcp_nopush on;
-	keepalive_timeout 120;
-	server_tokens off;
-	tcp_nodelay on;
+    include mime.types;
+    default_type application/octet-stream;
+    server_names_hash_bucket_size 128;
+    client_header_buffer_size 32k;
+    large_client_header_buffers 4 32k;
+    client_max_body_size 50m;
+    sendfile on;
+    tcp_nopush on;
+    keepalive_timeout 120;
+    server_tokens off;
+    tcp_nodelay on;
+    
+    fastcgi_connect_timeout 300;
+    fastcgi_send_timeout 300;
+    fastcgi_read_timeout 300;
+    fastcgi_buffer_size 64k;
+    fastcgi_buffers 4 64k;
+    fastcgi_busy_buffers_size 128k;
+    fastcgi_temp_file_write_size 128k;
 
-	fastcgi_connect_timeout 300;
-	fastcgi_send_timeout 300;
-	fastcgi_read_timeout 300;
-	fastcgi_buffer_size 64k;
-	fastcgi_buffers 4 64k;
-	fastcgi_busy_buffers_size 128k;
-	fastcgi_temp_file_write_size 128k;
+    #Gzip Compression
+    gzip on;
+    gzip_buffers 16 8k;
+    gzip_comp_level 6;
+    gzip_http_version 1.1;
+    gzip_min_length 256;
+    gzip_proxied any;
+    gzip_vary on;
+    gzip_types
+      text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
+      text/javascript application/javascript application/x-javascript
+      text/x-json application/json application/x-web-app-manifest+json
+      text/css text/plain text/x-component
+      font/opentype application/x-font-ttf application/vnd.ms-fontobject
+      image/x-icon;
+    gzip_disable  "msie6";
 
-#Gzip Compression
-	gzip on;
-	gzip_buffers 16 8k;
-	gzip_comp_level 6;
-	gzip_http_version 1.1;
-	gzip_min_length 256;
-	gzip_proxied any;
-	gzip_vary on;
-	gzip_types
-	    text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
-	    text/javascript application/javascript application/x-javascript
-	    text/x-json application/json application/x-web-app-manifest+json
-	    text/css text/plain text/x-component
-	    font/opentype application/x-font-ttf application/vnd.ms-fontobject
-	    image/x-icon;
-	gzip_disable  "msie6";
+    #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
+    open_file_cache max=1000 inactive=20s;
+    open_file_cache_valid 30s;
+    open_file_cache_min_uses 2;
+    open_file_cache_errors on;
 
-#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
-        open_file_cache max=1000 inactive=20s;
-        open_file_cache_valid 30s;
-        open_file_cache_min_uses 2;
-        open_file_cache_errors on;
-
-###################pureftpd AND phpmyadmin############################
-        server {
-        listen 80;
-        server_name _;
-        access_log /home/wwwlogs/access_nginx.log combined;
-        root /home/wwwroot/default;
-        index index.html index.php;
-        location ~ .*\.(php|php5)?$ {
-		#fastcgi_pass remote_php_ip:9000;
-	        fastcgi_pass unix:/dev/shm/php-cgi.sock;
-		fastcgi_index index.php;
-		include fastcgi.conf;
-		}
-        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
-		expires 30d;
-	        }
-        location ~ .*\.(js|css)?$ {
-                expires 7d;
-                }
+################### demo(you can delete) ############################
+    server {
+    listen 80;
+    server_name _;
+    access_log /home/wwwlogs/access_nginx.log combined;
+    root /home/wwwroot/default;
+    index index.html index.php;
+    location ~ .*\.(php|php5)?$ {
+        #fastcgi_pass remote_php_ip:9000;
+        fastcgi_pass unix:/dev/shm/php-cgi.sock;
+        fastcgi_index index.php;
+        include fastcgi.conf;
+        }
+    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
+        expires 30d;
+        }
+    location ~ .*\.(js|css)?$ {
+        expires 7d;
         }
+    }
 
 ##########################vhost#####################################
-	include vhost/*.conf;
+    include vhost/*.conf;
 }

+ 67 - 82
config/nginx_apache.conf

@@ -6,94 +6,79 @@ pid /var/run/nginx.pid;
 worker_rlimit_nofile 51200;
 
 events {
-	use epoll;
-	worker_connections 51200;
-	}
+    use epoll;
+    worker_connections 51200;
+    }
 
 http {
-	include mime.types;
-	default_type application/octet-stream;
-	server_names_hash_bucket_size 128;
-	client_header_buffer_size 32k;
-	large_client_header_buffers 4 32k;
-	client_max_body_size 50m;
-	sendfile on;
-	tcp_nopush on;
-	keepalive_timeout 120;
-	server_tokens off;
-	tcp_nodelay on;
+    include mime.types;
+    default_type application/octet-stream;
+    server_names_hash_bucket_size 128;
+    client_header_buffer_size 32k;
+    large_client_header_buffers 4 32k;
+    client_max_body_size 50m;
+    sendfile on;
+    tcp_nopush on;
+    keepalive_timeout 120;
+    server_tokens off;
+    tcp_nodelay on;
+    
+    fastcgi_connect_timeout 300;
+    fastcgi_send_timeout 300;
+    fastcgi_read_timeout 300;
+    fastcgi_buffer_size 64k;
+    fastcgi_buffers 4 64k;
+    fastcgi_busy_buffers_size 128k;
+    fastcgi_temp_file_write_size 128k;
 
-	proxy_connect_timeout 300s;
-	proxy_send_timeout 900;
-	proxy_read_timeout 900;
-	proxy_buffer_size 32k;
-	proxy_buffers 4 64k;
-	proxy_busy_buffers_size 128k;
-	proxy_redirect off;
-	proxy_hide_header Vary;
-	proxy_set_header Accept-Encoding '';
-	proxy_set_header Host $host;
-	proxy_set_header Referer $http_referer;
-	proxy_set_header Cookie $http_cookie;
-	proxy_set_header X-Real-IP $remote_addr;
-	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    #Gzip Compression
+    gzip on;
+    gzip_buffers 16 8k;
+    gzip_comp_level 6;
+    gzip_http_version 1.1;
+    gzip_min_length 256;
+    gzip_proxied any;
+    gzip_vary on;
+    gzip_types
+      text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
+      text/javascript application/javascript application/x-javascript
+      text/x-json application/json application/x-web-app-manifest+json
+      text/css text/plain text/x-component
+      font/opentype application/x-font-ttf application/vnd.ms-fontobject
+      image/x-icon;
+    gzip_disable  "msie6";
 
-	fastcgi_connect_timeout 300;
-	fastcgi_send_timeout 300;
-	fastcgi_read_timeout 300;
-	fastcgi_buffer_size 64k;
-	fastcgi_buffers 4 64k;
-	fastcgi_busy_buffers_size 128k;
-	fastcgi_temp_file_write_size 128k;
+    #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
+    open_file_cache max=1000 inactive=20s;
+    open_file_cache_valid 30s;
+    open_file_cache_min_uses 2;
+    open_file_cache_errors on;
 
-#Gzip Compression
-        gzip on;
-        gzip_buffers 16 8k;
-        gzip_comp_level 6;
-        gzip_http_version 1.1;
-        gzip_min_length 256;
-        gzip_proxied any;
-        gzip_vary on;
-        gzip_types
-            text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
-            text/javascript application/javascript application/x-javascript
-            text/x-json application/json application/x-web-app-manifest+json
-            text/css text/plain text/x-component
-            font/opentype application/x-font-ttf application/vnd.ms-fontobject
-            image/x-icon;
-        gzip_disable  "msie6";
-
-#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
-        open_file_cache max=1000 inactive=20s;
-        open_file_cache_valid 30s;
-        open_file_cache_min_uses 2;
-        open_file_cache_errors on;
-
-###################pureftpd AND phpmyadmin############################
-        server {
-        listen 80;
-        server_name _;
-        access_log /home/wwwlogs/access_nginx.log combined;
-        root /home/wwwroot/default;
-        index index.html index.php;
-	location / {
-		try_files $uri @apache;
-		}
-	location @apache {
-		internal;
-		proxy_pass http://127.0.0.1:9090;
-		}
-        location ~ .*\.(php|php5)?$  {
-		proxy_pass http://127.0.0.1:9090;
-		}
-        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
-                expires 30d;
-                }
-        location ~ .*\.(js|css)?$ {
-                expires 7d;
-                }
+################### demo(you can delete) ############################
+    server {
+    listen 80;
+    server_name _;
+    access_log /home/wwwlogs/access_nginx.log combined;
+    root /home/wwwroot/default;
+    index index.html index.php;
+    location / {
+        try_files $uri @apache;
+        }
+    location @apache {
+        internal;
+        proxy_pass http://127.0.0.1:9090;
+        }
+    location ~ .*\.(php|php5)?$  {
+        proxy_pass http://127.0.0.1:9090;
+        }
+    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
+        expires 30d;
+        }
+    location ~ .*\.(js|css)?$ {
+        expires 7d;
         }
+    }
 
 ##########################vhost#####################################
-	include vhost/*.conf;
+    include vhost/*.conf;
 }

+ 4 - 4
config/opencart.conf

@@ -1,16 +1,16 @@
 location = /sitemap.xml {
     rewrite ^(.*)$ /index.php?route=feed/google_sitemap break;
-}
+    }
 
 location = /googlebase.xml {
     rewrite ^(.*)$ /index.php?route=feed/google_base break;
-}
+    }
 
 location / {
     # This try_files directive is used to enable SEO-friendly URLs for OpenCart
     try_files $uri $uri/ @opencart;
-}
+    }
 
 location @opencart {
     rewrite ^/(.+)$ /index.php?_route_=$1 last;
-}
+    }

+ 3 - 3
config/typecho.conf

@@ -1,9 +1,9 @@
 if (-f $request_filename/index.html){
     rewrite (.*) $1/index.html break;
-}
+    }
 if (-f $request_filename/index.php){
     rewrite (.*) $1/index.php;
-}
+    }
 if (!-e $request_filename){
     rewrite (.*) /index.php;
-}
+    }

+ 2 - 2
config/wordpress.conf

@@ -1,4 +1,4 @@
 location / {
-	try_files $uri $uri/ /index.php?$args;
-	}
+    try_files $uri $uri/ /index.php?$args;
+    }
 rewrite /wp-admin$ $scheme://$host$uri/ permanent;

+ 1 - 1
include/jemalloc.sh

@@ -11,7 +11,7 @@
 Install_jemalloc()
 {
 cd $oneinstack_dir/src
-src_url=http://www.canonware.com/download/jemalloc/jemalloc-$jemalloc_version.tar.bz2 && Download_src
+src_url=https://github.com/jemalloc/jemalloc/releases/download/$jemalloc_version/jemalloc-$jemalloc_version.tar.bz2 && Download_src
 
 tar xjf jemalloc-$jemalloc_version.tar.bz2
 cd jemalloc-$jemalloc_version

+ 1 - 1
include/tcmalloc.sh

@@ -11,7 +11,7 @@
 Install_tcmalloc()
 {
 cd $oneinstack_dir/src
-src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-$tcmalloc_version.tar.gz && Download_src
+src_url=https://github.com/gperftools/gperftools/releases/download/gperftools-$tcmalloc_version/gperftools-$tcmalloc_version.tar.gz && Download_src
 
 tar xzf gperftools-$tcmalloc_version.tar.gz 
 cd gperftools-$tcmalloc_version

+ 25 - 25
vhost.sh

@@ -125,11 +125,11 @@ else
 fi
 
 if [ "$NGX_FLAG" == 'php' ];then
-    NGX_CONF="location ~ .*\.(php|php5)?$ {\n\t#fastcgi_pass remote_php_ip:9000;\n\tfastcgi_pass unix:/dev/shm/php-cgi.sock;\n\tfastcgi_index index.php;\n\tinclude fastcgi.conf;\n\t}"
+    NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi.conf;\n    }")
 elif [ "$NGX_FLAG" == 'java' ];then
-    NGX_CONF="location ~ {\n\tproxy_set_header Host \$host;\n\tproxy_set_header X-Real-IP \$remote_addr;\n\tproxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n\tproxy_pass http://127.0.0.1:8080;\n\t}"
+    NGX_CONF=$(echo -e "location ~ {\n    proxy_set_header Host \$host;\n    proxy_set_header X-Real-IP \$remote_addr;\n    proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n    proxy_pass http://127.0.0.1:8080;\n    }")
 elif [ "$NGX_FLAG" == 'hhvm' ];then
-    NGX_CONF="location ~ .*\.(php|php5)?$ {\n\tfastcgi_pass unix:/var/log/hhvm/sock;\n\tfastcgi_index index.php;\n\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n\tinclude fastcgi_params;\n\t}"
+    NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n    fastcgi_pass unix:/var/log/hhvm/sock;\n    fastcgi_index index.php;\n    fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n    include fastcgi_params;\n    }")
 fi
 }
 
@@ -221,7 +221,7 @@ if [ "$anti_hotlinking_yn" == 'y' ];then
     else
         domain_allow_all=$domain_allow
     fi
-    anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {\n\tvalid_referers none blocked $domain_allow_all;\n\tif (\$invalid_referer) {\n\t\t#rewrite ^/ http://www.linuxeye.com/403.html;\n\t\treturn 403;\n\t\t}\n\t}")
+    anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {\n    valid_referers none blocked $domain_allow_all;\n    if (\$invalid_referer) {\n        #rewrite ^/ http://www.linuxeye.com/403.html;\n        return 403;\n        }\n    }")
 else
     anti_hotlinking=
 fi
@@ -293,12 +293,12 @@ index index.html index.htm index.jsp index.php;
 root $vhostdir;
 $anti_hotlinking
 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
-        expires 30d;
-        }
+    expires 30d;
+    }
 location ~ .*\.(js|css)?$ {
-        expires 7d;
-        }
-`echo -e $NGX_CONF`
+    expires 7d;
+    }
+$NGX_CONF
 }
 EOF
 
@@ -339,13 +339,13 @@ index index.html index.htm index.jsp index.php;
 include $rewrite.conf;
 root $vhostdir;
 $anti_hotlinking
-`echo -e $NGX_CONF`
+$NGX_CONF
 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
-	expires 30d;
-	}
+    expires 30d;
+    }
 location ~ .*\.(js|css)?$ {
-	expires 7d;
-	}
+    expires 7d;
+    }
 }
 EOF
 
@@ -452,21 +452,21 @@ index index.html index.htm index.jsp index.php;
 root $vhostdir;
 $anti_hotlinking
 location / {
-	try_files \$uri @apache;
-	}
+    try_files \$uri @apache;
+    }
 location @apache {
-	internal;
-	proxy_pass http://127.0.0.1:9090;
-	}
+    internal;
+    proxy_pass http://127.0.0.1:9090;
+    }
 location ~ .*\.(php|php5)?$ {
-	proxy_pass http://127.0.0.1:9090;
-	}
+    proxy_pass http://127.0.0.1:9090;
+    }
 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
-	expires 30d;
-	}
+    expires 30d;
+    }
 location ~ .*\.(js|css)?$ {
-	expires 7d;
-	}
+    expires 7d;
+    }
 }
 EOF