Category: Uncategorized

  • Migration to NGINX

    for some reason i wanted to switch from Apache2 to NGINX and now i am quite happy with my decision.

    So the first step was obviously to disable Apache2 and install NGINX, i read up on some differences between the configs and quickly migrated my old configs to the NGINX format.
    So this:

    <VirtualHost *:80>
        ServerName git.iezn.de
        ServerAlias git.iezn.de
        ProxyPreserveHost On
    
        ProxyPass / https://iezn.de:3002/
        ProxyPassReverse / https://iezn.de:3002/
    
        ErrorLog ${APACHE_LOG_DIR}/gittea-error.log
        CustomLog ${APACHE_LOG_DIR}/gittea-access.log combined
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =git.iezn.de
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>

    turned into:

    server {
        listen 80;
        listen [::]:80;
        server_name git.iezn.de;
    
        location / {
            proxy_pass https://localhost:3002;
    
            proxy_http_version 1.1;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $http_host;
        }
    
        access_log /var/log/nginx/git.access.log;
        error_log /var/log/nginx/git.error.log error;
    }
    

    which with the help of certbot turned into:

    server {
        server_name git.iezn.de;
    
        location / {
            proxy_pass https://localhost:3002;
    
            proxy_http_version 1.1;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $http_host;
        }
    
        access_log /var/log/nginx/git.access.log;
        error_log /var/log/nginx/git.error.log error;
    
        listen [::]:443 ssl; # managed by Certbot
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/git.iezn.de/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/git.iezn.de/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
    }
        server {
            if ($host = git.iezn.de) {
            return 301 https://$host$request_uri;
        } # managed by Certbot
    
        listen 80;
        listen [::]:80;
        server_name git.iezn.de;
        return 404; # managed by Certbot
    }

    and to be honest… using certbot with NGINX was WAY easier than using it with Apache2

    Also the problem with gittea that i talked about in Gittea and Apache Config never showed up here…