56 lines
1.3 KiB
Plaintext
56 lines
1.3 KiB
Plaintext
server {
|
|
listen 192.168.1.2:80;
|
|
server_name 898.ro www.898.ro;
|
|
charset utf-8;
|
|
root /var/www/html;
|
|
index index.html;
|
|
|
|
access_log /var/log/nginx/898.ro.access.log;
|
|
error_log /var/log/nginx/898.ro.error.log;
|
|
|
|
# gzip should not be used with SSL
|
|
gzip off;
|
|
|
|
listen 192.168.1.2:443 ssl http2;
|
|
ssl_certificate /etc/letsencrypt/live/www.898.ro/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/www.898.ro/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
|
|
# redirect www.898.ro to 898.ro for both HTTP and HTTPS
|
|
if ($host = www.898.ro) {
|
|
return 301 $scheme://898.ro$request_uri;
|
|
}
|
|
|
|
# Redirect /blog/ URLs to index page
|
|
location ~ ^/blog/(.*) {
|
|
return 301 https://898.ro;
|
|
}
|
|
|
|
# Redirect /blog/tag/ URLs to /tags/
|
|
location ~ ^/blog/tag/(.*) {
|
|
return 301 https://898.ro/tags/$1;
|
|
}
|
|
|
|
# Redirect /tag/ URLs to /tags/
|
|
location ~ ^/tags/(.*) {
|
|
return 301 https://898.ro;
|
|
}
|
|
|
|
# Redirect /en/ URLs
|
|
location ~ ^/en/(.*) {
|
|
return 301 https://898.ro;
|
|
}
|
|
|
|
# Redirect /tag/ URLs to /tags/
|
|
location ~ ^/tag/(.*) {
|
|
return 301 https://898.ro/tags/$1;
|
|
}
|
|
|
|
# default location - proxy to local Jekyll
|
|
location / {
|
|
proxy_pass http://127.0.0.1:4000/;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
}
|
|
}
|