One place for hosting & domains

      blog

      Subscribe to Linode Status Updates


      Updated by Linode Contributed by Linode

      Use promo code DOCS10 for $10 credit on a new account.

      The Linode Status Page provides real-time system status and maintenance updates via email, SMS, and Atom and RSS feed. All Linode customers are encouraged to subscribe to Linode Status notifications to stay up to date with any events that may impact your service.

      When you sign up for Linode status updates via email or SMS, you can fine-tune which service updates you receive. These different topic areas are referred to as components. If, for example, all your Linodes are restricted to the Newark Data Center, you may only wish to subscribe to the Newark component. You can also subscribe to individual incident notifications.

      Status Update Components

      • Linode Manager and API
      • Hosted DNS Service
      • London
      • Newark
      • Atlanta
      • Dallas
      • Fremont
      • Tokyo 1
      • Tokyo 2
      • Singapore
      • Frankfurt

      Subscribe to Updates

      To subscribe to Linode system status and maintenance updates:

      1. Navigate to the Linode Status Page.

      2. Click on the Subscribe to Updates button and select your preferred notification format. The available options are email, SMS, and RSS feed.

        Subscribe to Linode status updates.

        Email or SMS

      • If selecting email or SMS, provide your contact information and click on the Subscribe via Email or Subscribe via SMS button.

      • You will be brought to the Notifications Subscription page where you can select which components to be updated on.

      • Click on the Update Preferences button.

        • If you are signing up for email notifications, you will need to check your email and confirm the subscription before you will start to receive updates.

        • If you are signing up for SMS notifications, you will receive a text message with instructions on how to confirm your subscription.

        RSS

      • If selecting RSS, click on the Atom Feed or RSS Feed link. You will be brought to a page with the raw XML feed.

      • Copy the page’s URL. Navigate to your RSS aggregator and paste the URL when setting up the feed.

      Subscribe to an Incident

      To subscribe to updates for a specific incident:

      1. Navigate to the Linode Status Page.

      2. Find the incident you would like to follow and click on its heading. You will be brought to that incident’s page.

      3. Click on the Subscribe to Updates button and provide your Email and/or telephone number.

      Update Notification Preferences or Unsubscribe

      You can update your component preferences or cancel your subscription to Linode status and maintenance updates at any time. To update your preferences or to unsubscribe:

      1. Navigate to the Linode Status Page.

      2. Click on the Subscribe to Updates button and select the notification format you would like to update or unsubscribe from.

        Email or SMS

      • Enter in your contact information and click on the Subscribe to Updates button.

      • You will be brought to your Notification Subscription page. Update your preferences, as needed, and click on the Update Preferences button.

      • If you would like to unsubscribe, click on the Cancel Subscription link in the Subscriber section of the page and follow the prompt.

      Note

      You can unsubscribe from SMS notifications by replying to any text message notification with the word “STOP”.

      RSS

      • To unsubscribe from Linode status updates via RSS, use your RSS aggregator’s settings to remove the feed.

      Join our Community

      Find answers, ask questions, and help others.

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



      Source link

      How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Debian 9


      Introduction

      The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications. This is an acronym that describes a Linux operating system, with an Nginx web server. The backend data is stored in the MySQL database and the dynamic processing is handled by PHP.

      In this guide, you’ll install a LEMP stack on a Debian server using the packages provided by the operating system.

      Prerequisites

      To complete this guide, you will need a Debian 9 server with a non-root user with sudo privileges. You can set up a user with these privileges in our Initial Server Setup with Debian 9 guide.

      Step 1 — Installing the Nginx Web Server

      In order to display web pages to our site visitors, we are going to employ Nginx, a modern, efficient web server.

      All of the software we will be using for this procedure will come directly from Debian’s default package repositories. This means we can use the apt package management suite to complete the installation.

      Since this is our first time using apt for this session, we should start off by updating our local package index. We can then install the server:

      • sudo apt update
      • sudo apt install nginx

      On Debian 9, Nginx is configured to start running upon installation.

      If you have the ufw firewall running, you will need to allow connections to Nginx. You should enable the most restrictive profile that will still allow the traffic you want. Since we haven’t configured SSL for our server yet, in this guide, we will only need to allow traffic on port 80.

      You can enable this by typing:

      • sudo ufw allow 'Nginx HTTP'

      You can verify the change by typing:

      You should see HTTP traffic allowed in the displayed output:

      Output

      Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Nginx HTTP ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx HTTP (v6) ALLOW Anywhere (v6)

      Now, test if the server is up and running by accessing your server's domain name or public IP address in your web browser. If you do not have a domain name pointed at your server and you do not know your server's public IP address, you can find it by typing one of the following into your terminal:

      • ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's//.*$//'

      This will print out a few IP addresses. You can try each of them in turn in your web browser.

      Type one of the addresses that you receive in your web browser. It should take you to Nginx's default landing page:

      http://your_domain_or_IP
      

      Nginx default page

      If you see the above page, you have successfully installed Nginx.

      Step 2 — Installing MySQL to Manage Site Data

      Now that we have a web server, we need to install MySQL, a database management system, to store and manage the data for our site.

      You can install this easily by typing:

      • sudo apt install mysql-server

      Note: In Debian 9 a community fork of the MySQL project – MariaDB – is packaged as the default MySQL variant. While, MariaDB works well in most cases, if you need features found only in Oracle's MySQL, you can install and use packages from a repository maintained by the MySQL developers. To install the official MySQL server, use our tutorial How To Install the Latest MySQL on Debian 9.

      The MySQL database software is now installed, but its configuration is not complete.

      To secure the installation, we can run a security script that will ask whether we want to modify some insecure defaults. Begin the script by typing:

      • sudo mysql_secure_installation

      You will be asked to enter the password for the MySQL root account. We haven't set this yet, so just hit ENTER. Then you'll be asked you if you want to set that password. You should type y then set a root password.

      For the rest of the questions the script asks, you should press y, followed by the ENTER key at each prompt. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes you have made.

      At this point, your database system is now set up and secured. Let's set up PHP.

      Step 3 — Installing PHP for Processing

      We now have Nginx installed to serve our pages and MySQL installed to store and manage our data. However, we still don't have anything that can generate dynamic content. That's where PHP comes in.

      Since Nginx does not contain native PHP processing like some other web servers, we will need to install fpm, which stands for "fastCGI process manager". We will tell Nginx to pass PHP requests to this software for processing. We'll also install an additional helper package that will allow PHP to communicate with our MySQL database backend. The installation will pull in the necessary PHP core files to make that work.

      Then install the php-fpm and php-mysql packages:

      • sudo apt install php-fpm php-mysql

      We now have our PHP components installed. Next we'll configure Nginx to use them.

      Step 4 — Configuring Nginx to Use the PHP Processor

      Now we have all of the required components installed. The only configuration change we still need is to tell Nginx to use our PHP processor for dynamic content.

      We do this on the server block level (server blocks are similar to Apache's virtual hosts). We're going to leave the default Nginx configuration alone and instead create a new configuration file and new web root directory to hold our PHP files. We'll name the configuration file and the directory after the domain name or hostname that the server should respond to.

      First, create a new directory in /var/www to hold the PHP site:

      • sudo mkdir /var/www/your_domain

      Then, open a new configuration file in Nginx's sites-available directory:

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

      This will create a new blank file. Paste in the following bare-bones configuration:

      /etc/nginx/sites-available/your_domain

      server {
          listen 80;
          listen [::]:80;
      
          root /var/www/your_domain;
          index index.php index.html index.htm;
      
          server_name your_domain;
      
          location / {
              try_files $uri $uri/ =404;
          }
      
          location ~ .php$ {
              include snippets/fastcgi-php.conf;
              fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
          }
      }
      

      This is a very basic configuration that listens on port 80 and serves files from the web root we just created. It will only respond to requests to the name provided after server_name, and any files ending in .php will be processed by the php-fpm process before Nginx sends the results to the user.

      Save and close the file when you're done customizing it.

      Activate your configuration by linking to the config file from Nginx's sites-enabled directory:

      • sudo ln -s /etc/nginx/sites-available/your_domain.conf /etc/nginx/sites-enabled/

      This will tell Nginx to use the configuration next time it is reloaded. First, test your configuration for syntax errors by typing:

      If any errors are reported, go back and recheck your file before continuing.

      When you are ready, reload Nginx to make the changes:

      • sudo systemctl reload nginx

      Next we'll create a file in our new web root directory to test out PHP processing.

      Step 5 — Create a PHP File to Test Configuration

      Your LEMP stack should now be completely set up. We can test it to validate that Nginx can correctly hand .php files off to our PHP processor.

      We can do this by creating a test PHP file in our document root. Open a new file called info.php within your document root in your text editor:

      • sudo nano /var/www/your_domain/info.php

      Type or paste the following lines into the new file. This is valid PHP code that will return information about our server:

      /var/www/your_domain/info.php

      <?php
        phpinfo();
      ?>
      

      When you are finished, save and close the file.

      Now, you can visit this page in your web browser by visiting your server's domain name or public IP address followed by /info.php:

      http://your_domain/info.php
      

      You should see a web page that has been generated by PHP with information about your server:

      PHP page info

      If you see a page that looks like this, you've set up PHP processing with Nginx successfully.

      After verifying that Nginx renders the page correctly, it's best to remove the file you created as it can actually give unauthorized users some hints about your configuration that may help them try to break in.

      For now, remove the file by typing:

      • sudo rm /var/www/html/info.php

      You can always regenerate this file if you need it later.

      Conclusion

      You should now have a LEMP stack configured on your Debian server. This gives you a very flexible foundation for serving web content to your visitors.



      Source link

      How to Install Ghost CMS with Docker Compose on Ubuntu 18.04


      Updated by Linode

      Written by Linode


      Use promo code DOCS10 for $10 credit on a new account.

      Ghost is an open source blogging platform that helps you easily create a professional-looking online blog.

      Ghost’s 1.0.0 version was the first major, stable release of the Ghost content management system (CMS). Ghost includes a Markdown editor, refreshed user interface, new default theme design, and more. Ghost has been frequently updated since this major release, and the current version at time of publication is 1.25.5.

      In this guide you’ll deploy Ghost using Docker Compose on Ubuntu 18.04. Ghost is powered by JavaScript and Node.js. Using Docker to deploy Ghost will encapsulate all of Ghost’s Node dependencies and keep the deployment self-contained. The Docker Compose services are also fast to set up and easy to update.

      Before you Begin

      1. Familiarize yourself with Linode’s Getting Started guide and complete the steps for deploying and setting up a Linode running Ubuntu 18.04, including setting the hostname and timezone.

      2. This guide uses sudo wherever possible. Complete the sections of our Securing Your Server guide to create a standard user account, harden SSH access and remove unnecessary network services.

        Note

        Replace each instance of example.com in this guide with your Ghost site’s domain name.

      3. Complete the Add DNS Records steps to register a domain name that will point to your Ghost Linode.

      4. Ensure your system is up to date:

        sudo apt update && sudo apt upgrade
        
      5. Your Ghost site will serve its content over HTTPS, so you will need to obtain an SSL/TLS certificate. Use Certbot to request and download a free certificate from Let’s Encrypt:

        sudo apt install software-properties-common
        sudo add-apt-repository ppa:certbot/certbot
        sudo apt update
        sudo apt install certbot
        sudo certbot certonly --standalone -d example.com
        

        These commands will download a certificate to /etc/letsencrypt/live/example.com/ on your Linode.


        Why not use Certbot’s Docker container?

        When your certificate is periodically renewed, your web server needs to be reloaded in order to use the new certificate. This is usually accomplished by passing a web server reload command through Certbot’s --deploy-hook option.

        In your deployment, the web server will run in its own container, and the Certbot container would not be able to directly reload it. A workaround for this limitation would be needed to enable this architecture.

      6. Install Docker and Docker Compose before proceeding. If you haven’t used Docker before, review the Introduction to Docker, When and Why to Use Docker, and How to Use Docker Compose guides for some context on how these technologies work.

      Install Docker

      These steps install Docker Community Edition (CE) using the official Ubuntu repositories. To install on another distribution, see the official installation page.

      1. Remove any older installations of Docker that may be on your system:

        sudo apt remove docker docker-engine docker.io
        
      2. Make sure you have the necessary packages to allow the use of Docker’s repository:

        sudo apt install apt-transport-https ca-certificates curl software-properties-common
        
      3. Add Docker’s GPG key:

        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
        
      4. Verify the fingerprint of the GPG key:

        sudo apt-key fingerprint 0EBFCD88
        

        You should see output similar to the following:

        pub   4096R/0EBFCD88 2017-02-22
              Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
        uid                  Docker Release (CE deb) <docker@docker.com>
        sub   4096R/F273FCD8 2017-02-22
        
      5. Add the stable Docker repository:

        sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
        
      6. Update your package index and install Docker CE:

        sudo apt update
        sudo apt install docker-ce
        
      7. Add your limited Linux user account to the docker group:

        sudo usermod -aG docker exampleuser
        

        You will need to restart your shell session for this change to take effect.

      8. Check that the installation was successful by running the built-in “Hello World” program:

        docker run hello-world
        

      Install Docker Compose

      1. Download the latest version of Docker Compose. Check the releases page and replace 1.21.2 in the command below with the version tagged as Latest release:

        sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
        
      2. Set file permissions:

        sudo chmod +x /usr/local/bin/docker-compose
        

      Install Ghost

      The Ghost deployment has three components:

      • The Ghost service itself;
      • A database (MySQL) that will store your blog posts;
      • A web server (NGINX) that will proxy requests on HTTP and HTTPS to your Ghost service.

      These services are listed in a single Docker Compose file.

      Create the Docker Compose file

      1. Create and change to a directory to hold your new Docker Compose services:

        mkdir ghost && cd ghost
        
      2. Create a file named docker-compose.yml and open it in your text editor. Paste in the contents from the following snippet. Replace example.com with your domain, and insert a new database password where your_database_root_password appears. The values for database__connection__password and MYSQL_ROOT_PASSWORD should be the same:

        docker-compose.yml
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        38
        39
        
        version: '3'
        services:
        
          ghost:
            image: ghost:latest
            restart: always
            depends_on:
              - db
            environment:
              url: https://example.com
              database__client: mysql
              database__connection__host: db
              database__connection__user: root
              database__connection__password: your_database_root_password
              database__connection__database: ghost
            volumes:
              - /opt/ghost_content:/var/lib/ghost/content
        
          db:
            image: mysql:5.7
            restart: always
            environment:
              MYSQL_ROOT_PASSWORD: your_database_root_password
            volumes:
              - /opt/ghost_mysql:/var/lib/mysql
        
          nginx:
            build:
              context: ./nginx
              dockerfile: Dockerfile
            restart: always
            depends_on:
              - ghost
            ports:
              - "80:80"
              - "443:443"
            volumes:
               - /etc/letsencrypt/:/etc/letsencrypt/
               - /usr/share/nginx/html:/usr/share/nginx/html
      3. The Docker Compose file creates a few Docker bind mounts:

        • /var/lib/ghost/content and /var/lib/mysql inside your containers are mapped to /opt/ghost_content and /opt/ghost_mysql on the Linode. These locations store your Ghost content.

        • NGINX uses a bind mount for /etc/letsencrypt/ to access your Let’s Encrypt certificates.

        • NGINX also uses a bind mount for /usr/share/nginx/html so that it can access the Let’s Encrypt challenge files that are created when your certificate is renewed.

        Create directories for those bind mounts (except for /etc/letsencrypt/, which was already created when you first generated your certificate):

        sudo mkdir /opt/ghost_content
        sudo mkdir /opt/ghost_mysql
        sudo mkdir -p /usr/share/nginx/html
        

      Create the NGINX Docker Image

      The Docker Compose file relies on a customized NGINX image. This image will be packaged with the appropriate server block settings.

      1. Create a new nginx directory for this image:

        mkdir nginx
        
      2. Create a file named Dockerfile in the nginx directory and paste in the following contents:

        nginx/Dockerfile
        1
        2
        3
        
        FROM nginx:latest
        
        COPY default.conf /etc/nginx/conf.d
      3. Create a file named default.conf in the nginx directory and paste in the following contents. Replace all instances of example.com with your domain:

        nginx/default.conf
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        
        server {
          listen 80;
          listen [::]:80;
          server_name example.com;
          # Useful for Let's Encrypt
          location /.well-known/acme-challenge/ { root /usr/share/nginx/html; allow all; }
          location / { return 301 https://$host$request_uri; }
        }
        
        server {
          listen 443 ssl http2;
          listen [::]:443 ssl http2;
          server_name example.com;
        
          ssl_protocols TLSv1.2;
          ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
          ssl_prefer_server_ciphers on;
          ssl_session_cache shared:SSL:10m;
        
          ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
          ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        
          location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto https;
            proxy_pass http://ghost:2368;
          }
        }

        This configuration will redirect all requests on HTTP to HTTPS (except for Let’s Encrypt challenge requests), and all requests on HTTPS will be proxied to the Ghost service.

      Run and Test Your Site

      From the ghost directory start the Ghost CMS by running all services defined in the docker-compose.yml file:

      docker-compose up -d
      

      Verify that your blog appears by loading your domain in a web browser. It may take a few minutes for Docker to start your services, so try refreshing if the page does not appear when you first load it.

      If your site doesn’t appear in your browser, review the logs generated by Docker for more information. To see these errors:

      1. Shut down your containers:

        cd ghost
        docker-compose down
        
      2. Run Docker Compose in an attached state so that you can view the logs generated by each container:

        docker-compose up
        
      3. To shut down your services and return the command prompt again, press CTRL-C.

      Complete the Setup

      To complete the setup process, navigate to the Ghost configuration page by appending /ghost to the end of your blog’s URL or IP. This example uses https://example.com/ghost.

      1. On the welcome screen, click Create your account:

        Ghost Welcome Screen

      2. Enter your email, create a user and password, and enter a blog title:

        Create Your Account Screen

      3. Invite additional members to your team. If you’d prefer to skip this step, click I’ll do this later, take me to my blog! at the bottom of the page:

        Invite Your Team Screen

      4. Navigate to the Ghost admin area to create your first post, change your site’s theme, or configure additional settings:

        Ghost Admin Area

      Usage and Maintenance

      Because the option restart: always was assigned to your services in your docker-compose.yml file, you do not need to manually start your containers if you reboot your Linode. This option tells Docker Compose to automatically start your services when the server boots.

      Update Ghost

      Your docker-compose.yml specifies the latest version of the Ghost image, so it’s easy to update your Ghost version:

      docker-compose down
      docker-compose pull && docker-compose up -d
      

      Renew your Let’s Encrypt Certificate

      1. Open your Crontab in your editor:

        sudo crontab -e
        
      2. Add a line which will automatically invoke Certbot at 11PM every day. Replace example.com with your domain:

        0 23 * * *   certbot certonly -n --webroot -w /usr/share/nginx/html -d example.com --deploy-hook='docker exec ghost_nginx_1 nginx -s reload'
        

        Certbot will only renew your certificate if its expiration date is within 30 days. Running this every night ensures that if something goes wrong at first, the script will have a number of chances to try again before the expiration.

      3. You can test your new job with the --dry-run option:

        sudo bash -c "certbot certonly -n --webroot -w /usr/share/nginx/html -d example.com --deploy-hook='docker exec ghost_nginx_1 nginx -s reload'"
        

      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.

      Join our Community

      Find answers, ask questions, and help others.

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



      Source link