halcyon/nginx.conf

59 lines
2.1 KiB
Nginx Configuration File

server {
listen 80;
server_name YOUR_DOMAIN;
location / { return 301 https://$host$request_uri; }
}
server {
listen 443 ssl;
server_name YOUR_DOMAIN;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_certificate /etc/CHANGE_THIS/fullchain.pem;
ssl_certificate_key /etc/CHANGE_THIS/privkey.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 0;
root /srv/http;
index index.php;
location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
return 302 /;
}
location ~* \.(?:bat|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
return 404;
}
rewrite ^/home/?$ / permanent;
rewrite ^/login/?$ /login/login.php last;
rewrite ^/auth/?$ /login/auth.php last;
rewrite ^/logout/?$ /login/logout.php last;
rewrite ^/terms/?$ /login/terms.php last;
rewrite ^/local/?$ /local.php last;
rewrite ^/federated/?$ /federated.php last;
rewrite ^/notifications/?$ /notifications.php last;
rewrite ^/search/?$ /search_hash_tag.php last;
rewrite ^/search/users/?$ /search_user.php last;
rewrite ^/@(.+)@(.+).([a-z]+)/?$ /user.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/status/(.+?)?$ /user.php?user=@$1@$2.$3&status=$4 last;
rewrite ^/@(.+)@(.+).([a-z]+)/media/?$ /user_only_media.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/with_replies/?$ /user_include_replies.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/followers/?$ /user_followers.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/following/?$ /user_following.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/favourites/?$ /user_favorite.php?user=@$1@$2.$3 last;
rewrite ^/avatars/original/missing.png$ /assets/images/missing.png last;
rewrite ^/headers/original/missing.png$ /assets/images/missing_header.png last;
rewrite ^/404/?$ /404.php last;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}