User Tools

Site Tools


webapps:hugo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
webapps:hugo [2023/09/16 11:20] – [Hugo] lucidwebapps:hugo [2023/10/03 17:50] (current) – [Configure Nginx] lucid
Line 14: Line 14:
 Dependencies Dependencies
  
-  sudo apt install git nginx golang+  sudo apt install git golang
  
  
Line 67: Line 67:
     listen 80;     listen 80;
     server_name subdomain.domain.tld;     server_name subdomain.domain.tld;
-    root /var/www/html+    root /var/www/html;
 } }
 </code> </code>
Line 77: Line 77:
     listen 80;     listen 80;
     server_name 192.168.1.4;     server_name 192.168.1.4;
-    root /var/www/html+    root /var/www/html;
 } }
 </code> </code>
Line 87: Line 87:
 Add a file to the web root to make sure that everything works in your web browser before moving the actual website to the server. Add a file to the web root to make sure that everything works in your web browser before moving the actual website to the server.
  
-  sudo touch /var/www/html/index.html && echo "Hello World!" >/var/www/html/index.html+  sudo touch /var/www/html/index.html && echo "Hello World!"/dev/null | sudo tee -a /var/www/html/index.html
   sudo chown -R www-data:www-data /var/www/html   sudo chown -R www-data:www-data /var/www/html
  
Line 95: Line 95:
  
 Navigate your web browser to your domain or IP address and it should produce a white background with Hello World in the top left corner. Navigate your web browser to your domain or IP address and it should produce a white background with Hello World in the top left corner.
 +\\
 \\ \\
 \\ \\
 \\ \\
 =====Copying your Website to the Web Server===== =====Copying your Website to the Web Server=====
-For this all you need to do is copy your published hugo website to the web server. To publish your website you need to run ''hugo server'' to generate the website files.+For this all you need to do is copy your published hugo website to the web server. To publish your website and generate the necessary html you need to run ''hugo server'' without any flags. This will tell hugo to build the published your site, only generating html for the pages which are not marked as draft. After that is done, you can continue on to move those files to the web server.
  
  
Line 111: Line 112:
   put -R /publish   put -R /publish
      
-Now ssh into your web server+Disconnect from the hugo server and ssh into the web server. The files that were just transferred to the web server need to be placed into the /var/www/html directory or any other directory of your choosing, just remember to change the web root in the nginx config to match. 
 + 
 +Move the files in the publish directory to /var/www/html and set the permissions 
 + 
 +  mv ./publish/* /var/www/html/ 
 +  chown -R www-data:www-data /var/www/html 
 + 
 +Restart nginx 
 + 
 +  sudo systemctl restart nginx 
 +   
 +If everything went as expected, your hugo website should be available at your domain or IP, albeit without encryption.
webapps/hugo.1694863235.txt.gz · Last modified: 2023/09/16 11:20 by lucid