Skip to content

Instantly share code, notes, and snippets.

@jage
Created October 12, 2014 18:54
Show Gist options
  • Save jage/6889b8a49e4a5170d5b2 to your computer and use it in GitHub Desktop.
Save jage/6889b8a49e4a5170d5b2 to your computer and use it in GitHub Desktop.
--- nginx.conf.prev Sun Oct 12 20:44:43 2014
+++ nginx.conf Sun Oct 12 20:52:44 2014
@@ -8,13 +8,13 @@
events {
- worker_connections 1024;
+ worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
- charset utf-8;
+ charset utf-8;
server_tokens off;
@@ -42,9 +42,9 @@
gzip_types text/plain text/html text/css;
log_format main '$http_host $remote_addr - $remote_user '
- '[$time_local] "$request" $status '
- '$body_bytes_sent "$http_referer" '
- '"$http_user_agent"';
+ '[$time_local] "$request" $status '
+ '$body_bytes_sent "$http_referer" '
+ '"$http_user_agent"';
access_log logs/access_log main;
@@ -56,14 +56,14 @@
server {
location / {
root /htdocs;
- rewrite ^(.*) https://wiki.starkast.net/Phoo permanent break;
- if (-f $request_filename.html) {
- rewrite (.*) $1.html break;
- }
+ rewrite ^(.*) https://wiki.starkast.net/Phoo break;
+ if (-f $request_filename.html) {
+ rewrite (.*) $1.html break;
+ }
- if (-f $request_filename.php) {
- rewrite (.*) https://$host$uri.php break;
- }
+ if (-f $request_filename.php) {
+ rewrite (.*) https://$host$uri.php break;
+ }
}
location ~ \.php(/|$) {
set $script_name $uri;
@@ -75,7 +75,7 @@
}
if (!-f /htdocs$script_name) {
- return 404;
+ return 404;
}
include fastcgi_params;
@@ -87,40 +87,6 @@
}
}
- server {
- server_name mysql.starkast.net;
- rewrite ^(.*) https://https.starkast.net/mysql/ permanent;
- }
-
- # Redirects to HTTPS
- server {
- server_name https.starkast.net;
- rewrite ^(.*) https://https.starkast.net$1 permanent;
- }
- server {
- server_name secure.starkast.net;
- rewrite ^(.*) https://https.starkast.net$1 permanent;
- }
- server {
- server_name webmail.starkast.net;
- rewrite ^(.*)/$ https://https.starkast.net/mail/$1 permanent;
- }
- server {
- server_name wiki.starkast.net;
- rewrite ^(.*) https://wiki.starkast.net$1 permanent;
- }
- # SSL wiki.starkast.net (StartSSL)
- server {
- listen 213.132.119.53:443;
- server_name wiki.starkast.net;
- ssl on;
- ssl_certificate /etc/ssl/STAR_starkast_net.pem;
- ssl_certificate_key /etc/ssl/private/STAR_starkast_net.key;
- keepalive_timeout 70;
- location / {
- proxy_pass http://wiki.starkast.net;
- }
- }
# SSL https.starkast.net
server {
listen 213.132.119.53:443;
@@ -131,46 +97,46 @@
keepalive_timeout 70;
location / {
root /services/https;
- if (-f $request_filename.html) {
- rewrite (.*) $1.html break;
- }
+ if (-f $request_filename.html) {
+ rewrite (.*) $1.html break;
+ }
- if (-f $request_filename.php) {
- rewrite (.*) https://$host$uri.php break;
- }
+ if (-f $request_filename.php) {
+ rewrite (.*) https://$host$uri.php break;
+ }
location /mailadmin/admin {
- auth_basic "Mailadmin requires credentials.";
- auth_basic_user_file /services/https/mailadmin/admin/.htpasswd;
+ auth_basic "Mailadmin requires credentials.";
+ auth_basic_user_file /services/https/mailadmin/admin/.htpasswd;
}
}
- location /dentarg/ {
- alias /users/dentarg/htdocs/;
+ location /dentarg/ {
+ alias /users/dentarg/htdocs/;
# if (-f $request_filename.php) {
# rewrite (.*) https://$host.php break;
# }
- location ~ \.php(/|$) {
- set $script_name $uri;
- set $path_info "";
+ location ~ \.php(/|$) {
+ set $script_name $uri;
+ set $path_info "";
- if ($uri ~ ^(.+\.php)(/.*)$) {
- set $script_name $1;
- set $path_info $2;
- }
+ if ($uri ~ ^(.+\.php)(/.*)$) {
+ set $script_name $1;
+ set $path_info $2;
+ }
# if (!-f /users/dentarg/htdocs/$script_name) {
# return 404;
# }
- include fastcgi_params;
- fastcgi_pass unix:/fastcgi/dentarg/php.socket;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /users/dentarg/htdocs/$script_name;
- fastcgi_param SCRIPT_NAME $script_name;
- fastcgi_param PATH_INFO $path_info;
- fastcgi_param HTTPS on;
- }
- }
+ include fastcgi_params;
+ fastcgi_pass unix:/fastcgi/dentarg/php.socket;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME /users/dentarg/htdocs/$script_name;
+ fastcgi_param SCRIPT_NAME $script_name;
+ fastcgi_param PATH_INFO $path_info;
+ fastcgi_param HTTPS on;
+ }
+ }
location ~ \.php(/|$) {
@@ -183,7 +149,7 @@
}
if (!-f /services/https$script_name) {
- return 404;
+ return 404;
}
include fastcgi_params;
@@ -199,21 +165,22 @@
# Disabled accounts
server {
server_name disabled.starkast.net
- aspen.starkast.net
- anna.starkast.net
- norrbin.starkast.net
- isabelle.starkast.net
- kim.starkast.net
- ludvig.starkast.net
- jens.starkast.net
- phiberjenz.starkast.net
- niclas.starkast.net;
- error_page 404 /index.html;
- location /index.html {
+ aspen.starkast.net
+ anna.starkast.net
+ norrbin.starkast.net
+ isabelle.starkast.net
+ kim.starkast.net
+ ludvig.starkast.net
+ jens.starkast.net
+ phiberjenz.starkast.net
+ niclas.starkast.net;
+
+ error_page 404 /index.html;
+ location /index.html {
if (!-f $request_filename) {
root /disabled;
}
- }
+ }
}
@@ -222,92 +189,5 @@
server {
server_name im.starkast.net;
location / { root /services/im; }
- }
-
- server {
- server_name svn.starkast.net;
- location / { root /services/svn; }
- rewrite (.*) http://wiki.duh.se/SVN last;
- }
-
- server {
- server_name ftp.starkast.net;
- location / {
- root /ftp;
- index index.html;
- autoindex_exact_size off;
- rewrite ^/pub/multimedia/video(.*)$ /pub/video/$1 permanent;
- rewrite ^/pub/tmp/birdie16(.*)$ /pub/birdie16/$1 permanent;
- }
- }
-
- server {
- server_name drift.starkast.net;
- location / {
- root /vhosts/drift.starkast.net;
- rewrite (.*) https://wiki.starkast.net/Driftmeddelanden last;
- }
- }
-
- server {
- server_name support.starkast.net;
- location / {
- root /vhosts/support.starkast.net;
- rewrite (.*) https://wiki.starkast.net/Support last;
- }
- }
-
- ### Blogs
- upstream mephisto {
- server 127.0.0.1:8192;
- server 127.0.0.1:8193;
- }
- server {
- listen 127.0.0.1:8191;
- root /services/mephisto/public;
- index index.html index.htm;
- access_log off;
-
- rewrite /feed/atom.xml /feed;
-
- location / {
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- proxy_redirect off;
-
- if (-f $document_root/cache/$host$uri/index.html) {
- rewrite (.*) /cache/$host$1/index.html last;
- }
-
- if (-f $document_root/cache/$host$uri.html) {
- rewrite (.*) /cache/$host$1.html last;
- }
-
- if (-f $document_root/cache/$host$uri) {
- rewrite (.*) /cache/$host$1 last;
- }
-
- proxy_pass http://mephisto;
- }
-
- location /admin {
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- proxy_redirect off;
- proxy_pass http://mephisto;
- }
-
- location ~ ^/assets/\d+/ {
- rewrite ^/assets/(\d+)/(.+)$ /assets/$host/$1/$2 last;
- }
-
-
- location /assets { internal; }
- location /cache { internal; }
- location ~ ^/(images|javascripts|stylesheets)/mephisto {
- autoindex off;
- }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment