One place for hosting & domains

      Move

      How To Move an Nginx Web Root to a New Location on Ubuntu 20.04


      Introduction

      On Ubuntu, the Nginx web server stores its documents in /var/www/html, which is typically located on the root filesystem with the rest of the operating system. Sometimes, though, it’s helpful to move the document root to another location, such as a separate mounted filesystem. For example, if you serve multiple websites from the same Nginx instance, putting each site’s document root on its own volume allows you to scale in response to the needs of a specific site or client.

      In this guide, you will move an Nginx document root to a new location.

      Prerequisites

      To complete this guide, you will need:

      We will use the domain name your_domain in this tutorial, but you should substitute this with your own domain name.

      • A new location for your document root. In this tutorial, we will use the /mnt/volume-nyc3-01 directory for our new location. If you are using Block Storage on DigitalOcean, this guide will show you how to create and attach your volume. Your new document root location is configurable based on your needs, however. If you are moving your document root to a different storage device, you will want to select a location under the device’s mount point.

      Step 1 — Copying Files to the New Location

      On a fresh installation of Nginx, the document root is located at /var/www/html. By following the prerequisite guides, however, you created a new document root, /var/www/your_domain/html. You may have additional document roots as well. In this step, we will establish the location of our document roots and copy the relevant files to their new location.

      You can search for the location of your document roots using grep. Let’s search in the /etc/nginx/sites-enabled directory to limit our focus to active sites. The -R flag ensures that grep will print both the line with the root directive and the full filename in its output:

      • grep -R "root" /etc/nginx/sites-enabled

      If you followed the prerequisite tutorials on a fresh server, the result will look like this:

      Output

      /etc/nginx/sites-enabled/your_domain: root /var/www/your_domain/html; /etc/nginx/sites-enabled/default: root /var/www/html; /etc/nginx/sites-enabled/default: # deny access to .htaccess files, if Apache's document root /etc/nginx/sites-enabled/default:# root /var/www/your_domain;

      If you have pre-existing setups, your results may differ from what’s shown here. In either case, you can use the feedback from grep to make sure you’re moving the desired files and updating the appropriate configuration files.

      Now that you’ve confirmed the location of your document root, you can copy the files to their new location with rsync. Using the -a flag preserves the permissions and other directory properties, while -v provides verbose output so you can follow the progress of the sync:

      Note: Be sure there is no trailing slash on the directory, which may be added if you use tab completion. When there’s a trailing slash, rsync will dump the contents of the directory into the mount point instead of transferring it into a containing html directory.

      • sudo rsync -av /var/www/your_domain/html /mnt/volume-nyc3-01

      You will see output like the following:

      Output

      sending incremental file list created directory /mnt/volume-nyc3-01 html/ html/index.html sent 318 bytes received 39 bytes 714.00 bytes/sec total size is 176 speedup is 0.49

      With our files in place, let’s move on to modifying our Nginx configuration to reflect these changes.

      Step 2 — Updating the Configuration Files

      Nginx makes use of both global and site-specific configuration files. For background about the hierarchy of configuration files, take a look at “How To Configure The Nginx Web Server On a Virtual Private Server”. We will modify the server block file for our your_domain project: /etc/nginx/sites-enabled/your_domain.

      Note: Remember to replace your_domain with your domain name, and remember that you will be modifying the server block files that were output when you ran the grep command in Step 1.

      Start by opening /etc/nginx/sites-enabled/your_domain in an editor:

      • sudo nano /etc/nginx/sites-enabled/your_domain

      Find the line that begins with root and update it with the new root location. In our case this will be /mnt/volume-nyc3-01/html:

      /etc/nginx/sites-enabled/your_domain

      server {
      
              root /mnt/volume-nyc3-01/html;
              index index.html index.htm index.nginx-debian.html;
              . . .
      }
      . . .
      

      Keep an eye out for any other places that you see the original document root path outputted by grep in Step 1, including in aliases or rewrites. You will also want to update these to reflect the new document root location.

      When you’ve made all of the necessary changes, save and close the file.

      Step 3 — Restarting Nginx

      Once you’ve finished making the configuration changes, you can restart Nginx and test the results.

      First, make sure the syntax is correct:

      If everything is in order, it should return:

      Output

      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

      If the test fails, track down and fix the problems.

      Once the test passes, restart Nginx:

      • sudo systemctl restart nginx

      When the server has restarted, visit your affected sites and ensure they’re working as expected. Once you’re comfortable that everything is in order, don’t forget to remove the original copy of the data:

      • sudo rm -Rf /var/www/your_domain/html

      You have now successfully moved your Nginx document root to a new location.

      Conclusion

      In this tutorial, we covered how to change the Nginx document root to a new location. This can help you with basic web server administration, like effectively managing multiple sites on a single server. It also allows you to take advantage of alternative storage devices such as network block storage, which can be helpful in scaling a web site as its needs change.

      If you’re managing a busy or growing web site, you might be interested in learning how to set up Nginx with HTTP/2 to take advantage of its high transfer speed for content.



      Source link

      How to Move Objects Between Buckets in Linode's Object Storage


      Updated by Linode

      Contributed by
      Linode

      Marquee image for How to Move Objects Between Buckets in Linode's Object Storage

      Note

      Linode’s Object Storage is a globally-available, S3-compatible method for storing and accessing data. With Object Storage more widely available, you may have buckets in multiple locations, this guide shows you how to move objects between buckets quickly and easily.

      In this guide you learn how to move objects between buckets using:

      Before You Begin

      To learn how to enable Object Storage, see the How to Use Object Storage guide.

      Object Storage is similar to a subscription service. After it is enabled, you are billed at the flat rate regardless of whether or not there are active buckets on your account. Cancel Object Storage to stop billing for this flat rate.

      In all Object Storage URLs the cluster where your bucket is hosted is a part of the URL string.

      Note

      A cluster is defined as all buckets hosted by a unique URL; for example: us-east-1.linodeobjects.com, ap-south-1.linodeobjects.com, or eu-central-1.linodeobjects.com.

      Cyberduck Graphical Interface

      The easiest way to move objects between buckets is using a Graphical User Interface (GUI) such as Cyberduck. Using a GUI, you can simply drag and drop objects between buckets.

      Transfer Between Buckets in the Same Cluster

      To transfer objects within the same cluster on the same account, you need to open only one Cyberduck window.

      1. Open Cyberduck and make a connection to access your buckets as described in How to Use Linode Object Storage.

      2. Expand the two buckets you want to transfer objects between by clicking the down arrow to the left of the folders.

      3. Locate the object you want to transfer.

      4. Drag the item from the source location to the destination.

        Drag a File to Move

      5. Select multiple items or folders and drag the group to the destination.

        Drag Multiple Files to Move

      Transfer Between Buckets in Different Clusters

      To transfer objects between two clusters, whether they are on the same account or not, you need to open two separate Cyberduck widows so that you can make two separate connections.

      Note

      Transferring objects between two different connections creates a copy of the object(s). If you don’t want the original files in the source bucket, you need to delete them after the transfer.

      1. Open Cyberduck, click the File menu and select New Browser. A second interface window appears where you can create another connection.

      2. In the first window, connect to the source bucket and locate the object you want to copy.

      3. In the second window, connect to the destination bucket and navigate to the location you want to place a copy of the object.

      4. Drag the object from the source to the destination.

        Select Objects to Move Between Cyberduck Windows

      Note

      You can easily copy multiple items, folders, or buckets by selecting everything you want to move and dragging the group. If you move a bucket to another bucket, it creates a folder with that bucket name.

      Cyberduck CLI

      You can also use the Cyberduck CLI, duck, to move objects from one bucket to another using the command line. The file transfer tool duck, is available for Linux, macOS, and Windows. To transfer using duck, you need the access keys that you generated for the source and destination buckets.

      1. Install duck using the instructions for your platform.

      2. Use the access keys and bucket names in the following command to move objects between buckets:

        duck --copy s3://[email protected]$bucket_source/source_object_file_name s3://[email protected]$bucket_destination/destination_object_file_name
        

        After issuing this command, you may be asked for login information.

      Note

      The bucket source and destination names are the fully qualified names including the cluster name, for example: us-east-1.linodeobjects.com/example_bucket.

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      Cut the Bikeshedding! How to Use No-Code MVPs to Move Faster


      This tech talk will be streaming live on Tues, Jun 16, 2020 12:00 PM – 1:00 PM ET.
      RSVP for free on GotoWebinar here

      About the Talk

      Case studies of how the DigitalOcean team has used “no-code” MVPs to accelerate delivery timelines and reduce cost. The techniques shared will work for a one-person company just as well as they will work for a 1,000-people company.

      What you’ll learn

      How to use scrappy, “no code” MVPs to learn and hypothesis test, while keeping your team aligned and excited.

      This talk is designed for

      • Product development teams
      • Product managers
      • Startup founders

      About the Presenters

      Antonio Rosales (@a_webtone) and John Gannon (@johnmgannon) have worked together on the DigitalOcean Marketplace as an Engineering Manager/Product Manager tandem from inception through its scaleup beyond 150+ open source and commercial apps.

      How to Join

      This tech talk is free and open to everyone. Join the live event on Thu, Jun 16, 2020 12:00 PM – 1:00 PM ET by registering on GotoWebinar here. Antonio and John will be answering questions at the end.

      If you can’t make the live event, the recording and transcript will be published here as soon as it’s available.





      Source link