Advertisement
thanhlangso

configure nginx working with DLE

Oct 14th, 2011
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.47 KB | None | 0 0
  1. # This Configure made by thanhnv admin filezdown.com
  2. # I'm Selling cheap vps, contact me on yahoo: thanhtoday
  3. # server {
  4. #   ...
  5. # }
  6. # statements for each of your virtual hosts
  7.  
  8. server {
  9.  
  10.     listen   80; ## listen for ipv4
  11.     listen   [::]:80 default ipv6only=on; ## listen for ipv6
  12.  
  13.     server_name yourdomainhere.com;
  14.  
  15.     access_log  /var/log/nginx/localhost.access.log;
  16.  
  17.         rewrite ^/page/(.*)$ /index.php?cstart=$1 last;
  18.  
  19.     location / {
  20.         rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})(/?)+$" /index.php?year=$1&month=$2&day=$3 last;
  21.     rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)(/?)+$" /index.php?year=$1&month=$2&day=$3&cstart=$4 last;
  22.    
  23.     rewrite "^/([0-9]{4})/([0-9]{2})(/?)+$" /index.php?year=$1&month=$2 last;
  24.     rewrite "^/([0-9]{4})/([0-9]{2})/page/([0-9]+)(/?)+$" /index.php?year=$1&month=$2&cstart=$3 last;
  25.    
  26.     rewrite "^/([0-9]{4})(/?)+$" /index.php?year=$1 last;
  27.     rewrite "^/([0-9]{4})/page/([0-9]+)(/?)+$" /index.php?year=$1&cstart=$2 last;
  28.    
  29.     rewrite "^/([^.]+)/page/([0-9]+)(/?)+$" /index.php?do=cat&category=$1&cstart=$2 last;
  30.     rewrite "^/([^.]+)/?$" /index.php?do=cat&category=$1 last;
  31.  
  32.         root   /var/www;
  33.     index  index.php index.html index.htm;
  34.     }
  35.  
  36.     location /tags/ {
  37.     rewrite ^/tags/([^/]*)(/?)+$ /index.php?do=tags&tag=$1 last;
  38.     rewrite ^/tags/([^/]*)/page/([0-9]+)(/?)+$ /index.php?do=tags&tag=$1&cstart=$2 last;
  39.     }
  40.    
  41.     location /user/ {
  42.     rewrite ^/user/([^/]*)/rss.xml$ /engine/rss.php?subaction=allnews&user=$1 last;
  43.     rewrite ^/user/([^/]*)(/?)+$ /index.php?subaction=userinfo&user=$1 last;
  44.     rewrite ^/user/([^/]*)/page/([0-9]+)(/?)+$ /index.php?subaction=userinfo&user=$1&cstart=$2 last;
  45.     rewrite ^/user/([^/]*)/news(/?)+$ /index.php?subaction=allnews&user=$1 last;
  46.     rewrite ^/user/([^/]*)/news/page/([0-9]+)(/?)+$ /index.php?subaction=allnews&user=$1&cstart=$2 last;
  47.     rewrite ^/user/([^/]*)/news/rss.xml(/?)+$ /engine/rss.php?subaction=allnews&user=$1 last;
  48.     }  
  49.    
  50.     location /lastnews/ {
  51.     rewrite ^/lastnews/(/?)+$ /index.php?do=lastnews last;
  52.     rewrite ^/lastnews/page/([0-9]+)(/?)+$ /index.php?do=lastnews&cstart=$1 last;
  53.     }
  54.  
  55.     location /catalog/ {
  56.     rewrite ^/catalog/([^/]*)/rss.xml$ /engine/rss.php?catalog=$1 last;
  57.     rewrite ^/catalog/([^/]*)(/?)+$ /index.php?catalog=$1 last;
  58.     rewrite ^/catalog/([^/]*)/page/([0-9]+)(/?)+$ /index.php?catalog=$1&cstart=$2 last;
  59.     }
  60.  
  61.     location /newposts {
  62.     rewrite ^/newposts(/?)+$ /index.php?subaction=newposts last;
  63.     rewrite ^/newposts/page/([0-9]+)(/?)+$ /index.php?subaction=newposts&cstart=$1 last;
  64.     }
  65.  
  66.     location /favorites {
  67.     rewrite ^/favorites(/?)+$ /index.php?do=favorites last;
  68.     rewrite ^/favorites/page/([0-9]+)(/?)+$ /index.php?do=favorites&cstart=$1 last;
  69.     }
  70.    
  71.     location ~ \.(html|xml) {
  72.     rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$" /index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&cstart=$5&news_name=$6 last;
  73.     rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$" /index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5 last;
  74.         rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$" /engine/print.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5 last;
  75.         rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$" /index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4 last;
  76.  
  77.         rewrite "^/([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$4&news_page=$2&cstart=$3&seourl=$5&seocat=$1 last;
  78.         rewrite "^/([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$3&news_page=$2&seourl=$4&seocat=$1 last;
  79.         rewrite "^/([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /engine/print.php?news_page=$2&newsid=$3&seourl=$4&seocat=$1 last;
  80.         rewrite "^/([^.]+)/([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$2&seourl=$3&seocat=$1 last;
  81.  
  82.     rewrite "^/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$3&news_page=$1&cstart=$2&seourl=$4 last;
  83.     rewrite "^/page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$2&news_page=$1&seourl=$3 last;
  84.     rewrite "^/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /engine/print.php?news_page=$1&newsid=$2&seourl=$3 last;
  85.     rewrite "^/([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$1&seourl=$2 last;
  86.    
  87.     rewrite ^/rules.html$ /index.php?do=rules last;
  88.     rewrite ^/statistics.html$ /index.php?do=stats last;
  89.     rewrite ^/addnews.html$ /index.php?do=addnews last;
  90.     rewrite ^/rss.xml$ /engine/rss.php last;
  91.     rewrite ^/sitemap.xml$ /uploads/sitemap.xml last;
  92.  
  93.     rewrite "^/([^.]+)/rss.xml$" /engine/rss.php?do=cat&category=$1 last;
  94.     rewrite ^/page,([0-9]+),([^/]+).html$ /index.php?do=static&page=$2&news_page=$1 last;
  95.     rewrite ^/print:([^/]+).html$ /engine/print.php?do=static&page=$1 last;
  96.  
  97.     #rewrite %{REQUEST_FILENAME} !-f
  98.     #   rewrite "^/([^/]+).html$" /index.php?do=static&page=$1 last;
  99.     #       #rewrite ^search/(.*).html?$ /index.php?do=searchcloud&subaction=search&story=$1&x=$4&y=$5 last;
  100.     #
  101.     #           }
  102.  
  103.     }
  104.  
  105.     location /doc {
  106.         root   /usr/share;
  107.         autoindex on;
  108.         allow 127.0.0.1;
  109.         deny all;
  110.     }
  111.  
  112.     location /images {
  113.         root   /usr/share;
  114.         autoindex on;
  115.     }
  116.  
  117.     #error_page  404  /404.html;
  118.  
  119.     # redirect server error pages to the static page /50x.html
  120.     #
  121.     #error_page   500 502 503 504  /50x.html;
  122.     #location = /50x.html {
  123.     #   root   /var/www/nginx-default;
  124.     #}
  125.  
  126.     # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  127.     #
  128.     #location ~ \.php$ {
  129.         #proxy_pass   http://127.0.0.1;
  130.     #}
  131.  
  132.     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  133.     #
  134.     location ~ \.php$ {
  135.         fastcgi_pass   127.0.0.1:9000;
  136.         fastcgi_index  index.php;
  137.         fastcgi_param  SCRIPT_FILENAME /var/www$fastcgi_script_name;
  138.         include        fastcgi_params;
  139.  
  140.     }
  141.  
  142.     # deny access to .htaccess files, if Apache's document root
  143.     # concurs with nginx's one
  144.     #
  145.     location ~ /\.ht {
  146.         deny  all;
  147.     }
  148. }
  149.  
  150.  
  151. # another virtual host using mix of IP-, name-, and port-based configuration
  152. #
  153. #server {
  154. #listen   8000;
  155. #listen   somename:8080;
  156. #server_name  somename  alias  another.alias;
  157.  
  158. #location / {
  159. #root   html;
  160. #index  index.html index.htm;
  161. #}
  162. #}
  163.  
  164.  
  165. # HTTPS server
  166. #
  167. #server {
  168. #listen   443;
  169. #server_name  localhost;
  170.  
  171. #ssl  on;
  172. #ssl_certificate  cert.pem;
  173. #ssl_certificate_key  cert.key;
  174.  
  175. #ssl_session_timeout  5m;
  176.  
  177. #ssl_protocols  SSLv3 TLSv1;
  178. #ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
  179. #ssl_prefer_server_ciphers   on;
  180.  
  181. #location / {
  182. #root   html;
  183. #index  index.html index.htm;
  184. #}
  185. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement