{"id":1642,"date":"2024-03-13T10:28:41","date_gmt":"2024-03-13T10:28:41","guid":{"rendered":"https:\/\/blog.thomarite.uk\/?p=1642"},"modified":"2024-03-13T10:28:41","modified_gmt":"2024-03-13T10:28:41","slug":"rebuild-vps-blog","status":"publish","type":"post","link":"https:\/\/blog.thomarite.uk\/index.php\/2024\/03\/13\/rebuild-vps-blog\/","title":{"rendered":"Rebuild VPS\/Blog"},"content":{"rendered":"\n<p>Quite overdue. I need to fill all the gaps properly<\/p>\n\n\n\n<p>I went from Apache to NGINX to make it more challenging for me&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Make a proper backup of your VPS.<\/h2>\n\n\n\n<p>More details<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Get latest Debian stable<\/h2>\n\n\n\n<p>Or try to upgrade&#8230;<a href=\"https:\/\/www.cyberciti.biz\/faq\/update-upgrade-debian-9-to-debian-10-buster\/\">link<\/a>:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SSL Cert<\/h2>\n\n\n\n<p>Be sure you have <a href=\"https:\/\/letsencrypt.org\/getting-started\/\">Let&#8217;s Encrypt<\/a> setup for getting your free. Good thing, the DNS side was already done so it was just to configure NGINX<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">WordPress<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.linuxcapable.com\/how-to-install-wordpress-with-nginx-mariadb-php-on-debian-linux\/\">Link<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">phpMyAdmin<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.linuxcapable.com\/how-to-install-phpmyadmin-with-lemp-on-debian-linux\/\">Link<\/a>. I struggled with this. I had to make a minimal config and then put my backup. After that, I had my blog fully recover<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">NGINX config<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.keycdn.com\/support\/nginx-location-directive\">Link<\/a>. I struggled here because I had to serve my blog and phpadmin from nginx. I knew how to do it via Apache but was failing with nginx. I asked ChatGPT and at the end it gave me the solution<\/p>\n\n\n\n<p>This is the final config:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">server {\n    server_name thomarite.uk blog.thomarite.uk;\n    root \/var\/www\/html\/wordpress;\n    index index.php;\n\n    access_log \/var\/log\/nginx\/thomarite.uk.access.log;\n    error_log \/var\/log\/nginx\/thomarite.uk.error.log;\n\n    client_max_body_size 100M;\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php?$args;\n    }\n\n    location ~ \\.php$ {\n        include snippets\/fastcgi-php.conf;\n        fastcgi_pass unix:\/var\/run\/php\/php8.2-fpm.sock;\n        include fastcgi_params;\n        fastcgi_intercept_errors on;\n    }\n\n    location \/phpmyadmin\/ {\n        alias \/usr\/share\/phpmyadmin\/;\n        index index.php;\n\n        location ~ \\.php$ {\n            include snippets\/fastcgi-php.conf;\n            fastcgi_pass unix:\/var\/run\/php\/php8.2-fpm.sock;\n            include fastcgi_params;\n            fastcgi_intercept_errors on;\n\n            fastcgi_param SCRIPT_FILENAME $request_filename;\n            fastcgi_param PATH_INFO $fastcgi_path_info;\n        }\n    }\n\n    location ~* \\.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {\n        add_header Access-Control-Allow-Origin \"*\";\n        expires 90d;\n        access_log off;\n    }\n\n    location ~ \/\\.ht {\n        access_log off;\n        log_not_found off;\n        deny all;\n    }\n\n    listen [::]:443 ssl ipv6only=on; # managed by Certbot\n    listen 443 ssl; # managed by Certbot\n    ssl_certificate \/etc\/letsencrypt\/live\/thomarite.uk-0001\/fullchain.pem; # managed by Certbot\n    ssl_certificate_key \/etc\/letsencrypt\/live\/thomarite.uk-0001\/privkey.pem; # managed by Certbot\n    include \/etc\/letsencrypt\/options-ssl-nginx.conf; # managed by Certbot\n    ssl_dhparam \/etc\/letsencrypt\/ssl-dhparams.pem; # managed by Certbot\n}\n\nserver {\n    if ($host = blog.thomarite.uk) {\n        return 301 https:\/\/$host$request_uri;\n    } # managed by Certbot\n\n    if ($host = thomarite.uk) {\n        return 301 https:\/\/$host$request_uri;\n    } # managed by Certbot\n\n    listen 80;\n    listen [::]:80;\n    server_name thomarite.uk blog.thomarite.uk;\n\n    location \/ {\n        return 404;\n    }\n}\n\n\n<\/pre>\n\n\n\n<p>Then<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nginx -t\nsudo service nginx restart<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">IRCD<\/h2>\n\n\n\n<p>I need to check how this is installed properly. Check <a href=\"https:\/\/installati.one\/install-ircd-hybrid-debian-11\/\">this<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quite overdue. I need to fill all the gaps properly I went from Apache to NGINX to make it more challenging for me&#8230; Make a proper backup of your VPS. More details Get latest Debian stable Or try to upgrade&#8230;link: SSL Cert Be sure you have Let&#8217;s Encrypt setup for getting your free. Good thing, &hellip; <a href=\"https:\/\/blog.thomarite.uk\/index.php\/2024\/03\/13\/rebuild-vps-blog\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Rebuild VPS\/Blog&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1642","post","type-post","status-publish","format-standard","hentry","category-unix"],"_links":{"self":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/1642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1642"}],"version-history":[{"count":1,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/1642\/revisions"}],"predecessor-version":[{"id":1643,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/1642\/revisions\/1643"}],"wp:attachment":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/categories?post=1642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/tags?post=1642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}