Skip to content

Instantly share code, notes, and snippets.

@Gaupy
Last active August 29, 2015 13:56
Show Gist options
  • Save Gaupy/8793538 to your computer and use it in GitHub Desktop.
Save Gaupy/8793538 to your computer and use it in GitHub Desktop.
default:
server{
listen 80;
server_name impe.ga *.impe.ga *.laura-guillaume.fr;
rewrite ^(.*) https://$host$1 permanent;
}
sharelatex:
server{
listen 443;
server_name latex.impe.ga;
ssl on;
ssl_certificate /etc/nginx/ssl/impe.ga.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
location / {
proxy_pass http://localhost:3000;
}
}
subdomains:
server{
listen 443;
server_name ~^(?<subdomain>\w+)\.(?<domain>.+)$;
ssl on;
ssl_certificate /etc/nginx/ssl/laura-guillaume.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
root /sites/$domain/$subdomain;
index index.php index.html;
autoindex on;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
try_files $uri = 404; # Prevents exploit
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
}
server{
listen 443;
server_name impe.ga;
ssl on;
ssl_certificate /etc/nginx/ssl/impe.ga.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
#
# https://impe.ga/~<login>/
#
location ~ ^/~([^/]+)(/.*\.php)$ {
alias /home/$1/public_html;
autoindex on;
include /etc/nginx/fastcgi_params;
try_files $2 = 404; # Prevents exploit
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
location ~ ^/~([^/]+)(/.*)?$ {
alias /home/$1/public_html$2;
index index.php index.html;
autoindex on;
}
#
# https://impe.ga/
#
location ~ \.php$ {
root /sites/impe.ga/www;
index index.php index.html;
autoindex on;
include /etc/nginx/fastcgi_params;
try_files $uri = 404; # Prevents exploit
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
location ~ {
root /sites/impe.ga/www;
index index.php index.html;
autoindex on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment