MOMUS


lessons learned from selfhosting

my (mostly) linux related notes


linux-software

1. nginx

1.1 nginx template

1.2 tor nginx template

1.3 php in nginx

1.4 nginx autoindex

1.5 onion address advertising

1.6 nginx.conf options

2. ssh

2.1 ssh jumping

3. tor

4. certbot


1. NGINX

1.1 nginx template

            
                server {
                    listen 80 ;
                    listen [::]:80 ;
                    server_name {sitename} ;
                    root /var/www/{sitename} ;
                    index index.html index.htm ;
                    location / {
                        try_files $uri $uri/ =404 ;
                    }
                }
            
        

1.2 tor nginx template

            
                server {
                    listen 127.0.0.1:80 ;
                    server_name {onion-address} ;
                    root /var/www/{sitename} ;
                    index index.html index.htm ;
                    location / {
                        try_files $uri $uri/ =404 ;
                    }
                }
            
        

1.3 using php in nginx

                
                location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
                }
            
        

1.4 autoindex like in apache

            
                location / {
                    autoindex on;
                }
            
        

1.5 onion address advertising

            
                add_header Onion-Location http://{your-address}.onion$request_uri;
            
        

1.6 nginx.conf settings

            server_tokens off;
        

2. ssh

2.1 ssh jumping

            ssh -J {server1}  {server2} 
        

3. tor

3.1 torrc

3.1.1 starting a onion address

            
                HiddenServiceDir /var/lib/tor/hidden_service/
                HiddenServicePort 80 127.0.0.1:80
            
        

4. certbot

4.1 installing certbot

            
                sudo apt install python3-certbot python3-certbot-nginx
            
        

4.2 making a cert

            
                sudo certbot --nginx -d {domain} --register-unsafely-without-email
            
        

<-go back