Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. http {
  2. # Compression - requires gzip and gzip static modules.
  3. gzip on;
  4. gzip_static on;
  5. gzip_vary on;
  6. gzip_http_version 1.1;
  7. gzip_min_length 700;
  8.  
  9. # Compression levels over 6 do not give an appreciable improvement
  10. # in compression ratio, but take more resources.
  11. gzip_comp_level 6;
  12.  
  13. # IE 6 and lower do not support gzip with Vary correctly.
  14. gzip_disable "msie6";
  15. # Before nginx 0.7.63:
  16. #gzip_disable "MSIE [1-6]\.";
  17.  
  18. # Catch-all server for requests to invalid hosts.
  19. # Also catches vulnerability scanners probing IP addresses.
  20. server {
  21. # default specifies that this block is to be used when
  22. # no other block matches.
  23. listen 80 default;
  24.  
  25. server_name bogus;
  26. return 444;
  27. root /var/empty;
  28. }
  29.  
  30. # If you have domains with and without www prefix,
  31. # redirect one to the other.
  32. server {
  33. # Default port is 80.
  34. #listen 80;
  35.  
  36. server_name darkw.pl;
  37.  
  38. # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
  39. return 301 http://www.darkw.pl$request_uri;
  40. }
  41.  
  42. # The actual board domain.
  43. server {
  44. #listen 80;
  45. server_name darkw.pl;
  46.  
  47. # POPRAW JEŚLI JEST INNA \/
  48. root /public_html/;
  49.  
  50. location / {
  51. # phpBB uses index.htm
  52. index index.php index.html index.htm;
  53. try_files $uri $uri/ @rewriteapp;
  54. }
  55.  
  56. location @rewriteapp {
  57. rewrite ^(.*)$ /app.php/$1 last;
  58. }
  59.  
  60. location / {
  61. if ($http_host ~* "^www.darkw.pl(.*)"){
  62. rewrite ^(.*)$ https://darkw.pl/$1 redirect;
  63. }
  64. rewrite ^(.*)$ https://$http_host$request_uri redirect;
  65. rewrite ^/(.*)-f([0-9]*)/mcp.php(.*) /mcp.php?$query_string redirect;
  66. rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html /viewtopic.php?f=$2&t=$4&start=$5&$query_string break;
  67. rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*).html /viewtopic.php?f=$2&t=$4&$query_string break;
  68. rewrite ^/(.*)-f([0-9]*)/index-s([0-9]*).html /viewforum.php?f=$2&start=$3&$query_string break;
  69. rewrite ^/(.*)-f([0-9]*)/ /viewforum.php?f=$2&$query_string break;
  70. rewrite ^/(.*)-f([0-9]*) /viewforum.php?f=$2&$query_string break;
  71. if (!-e $request_filename){
  72. rewrite ^(.*)$ /app.php break;
  73. }
  74. }
  75.  
  76. # Deny access to internal phpbb files.
  77. location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb|store|vendor) {
  78. deny all;
  79. # deny was ignored before 0.8.40 for connections over IPv6.
  80. # Use internal directive to prohibit access on older versions.
  81. internal;
  82. }
  83.  
  84. # Pass the php scripts to fastcgi server specified in upstream declaration.
  85. location ~ \.php(/|$) {
  86. # Unmodified fastcgi_params from nginx distribution.
  87. include fastcgi_params;
  88. # Necessary for php.
  89. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  90. fastcgi_param PATH_INFO $fastcgi_path_info;
  91. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  92. fastcgi_param DOCUMENT_ROOT $realpath_root;
  93. try_files $uri $uri/ /app.php$is_args$args;
  94. fastcgi_pass php;
  95. }
  96.  
  97. # Correctly pass scripts for installer
  98. location /install/ {
  99. # phpBB uses index.htm
  100. try_files $uri $uri/ @rewrite_installapp;
  101.  
  102. # Pass the php scripts to fastcgi server specified in upstream declaration.
  103. location ~ \.php(/|$) {
  104. # Unmodified fastcgi_params from nginx distribution.
  105. include fastcgi_params;
  106. # Necessary for php.
  107. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  108. fastcgi_param PATH_INFO $fastcgi_path_info;
  109. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  110. fastcgi_param DOCUMENT_ROOT $realpath_root;
  111. try_files $uri $uri/ /install/app.php$is_args$args;
  112. fastcgi_pass php;
  113. }
  114. }
  115.  
  116. location @rewrite_installapp {
  117. rewrite ^(.*)$ /install/app.php/$1 last;
  118. }
  119.  
  120. # Deny access to version control system directories.
  121. location ~ /\.svn|/\.git {
  122. deny all;
  123. internal;
  124. }
  125. }
  126.  
  127. # If running php as fastcgi, specify php upstream.
  128. upstream php {
  129. server unix:/tmp/php.sock;
  130. }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement