nginx phpmyadmin config

	location /phpmyadmin {
	   root /usr/share/;
	   index index.php index.html index.htm;
	   location ~ ^/phpmyadmin/(.+\.php)$ {
			   try_files $uri =404;
			   root /usr/share/;
			   #fastcgi_pass unix:/run/php/php7.2-fpm.sock;
			   fastcgi_pass unix:/var/run/php/icba.lt.sock;
			   fastcgi_index index.php;
			   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
			   include /etc/nginx/fastcgi_params;
	   }
	   location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
			   root /usr/share/;
	   }
    }

ssl – certbot

certbot.eff.org

sudo certbot --apache
or
sudo certbot --apache -d www.example.com

with no inputs & domain & no redirect
sudo certbot -n --apache -d www.example.com --no-redirect

DELETE ssl sudo certbot delete or sudo certbot delete --cert-name example.com https://www.digitalocean.com/community/tutorials/an-introduction-to-let-s-encrypt https://medium.com/@hbayraktar/how-to-setup-lets-encrypt-ssl-for-apache-on-ubuntu-18-04-cfa97a83bc08

commands
https://certbot.eff.org/docs/using.html#certbot-commands
https://stackoverflow.com/questions/58626546/shell-script-to-make-site-https-using-certbot-and-nginx
1. remove site enabled
sudo rm /etc/nginx/sites-enabled/default

2. add site enabled
sudo ln -sf /etc/nginx/sites-available/your-domain.com /etc/nginx/sites-enabled/your-domain.com

3. test
sudo nginx -t

4. restart
sudo systemctl restart nginx

wordpress migration

You should read http://wiki.nginx.org/WordPress

sites-available:
    location /blog {
            try_files $uri $uri/ /blog/index.php?$args;
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(/blog)(/.*)$;
    }

create subdomain (nginx on digitalocean)

https://nicknetvideos.com/blog/post/how-to-run-a-website-in-a-subdomain-in-digital-ocean


1. goto domains/dns, Add a domain
2. create an "A record" for your subdomain
3. create folder: /var/www/subdomain.example.com (create index.html)
4. create file: /etc/nginx/sites-available/subdomain.example.com
5. symlink to the enabled sites:
   ln -s /etc/nginx/sites-available/subdomain.example.com /etc/nginx/sites-enabled/subdomain.example.com
6. To check the syntax of code in the server block is correct:
   sudo nginx -t
7. Restart: 
   sudo service nginx restart


sites-available file, subdomain.example.com:

server {
    listen 80;
    listen [::]:80;
    server_name api.domain.lt;

    root /var/www/api.domain.lt/public;
    index index.html index.php index.htm index.nginx-debian.html;

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }
	
    location ~ \.php$ {
		try_files $uri $uri/ ;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass unix:/run/php/php7.2-fpm.sock;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		include fastcgi_params;
		access_log /var/www/php-access.log;
    }
	
}