Get Started with LowEndSpirit

Very likely the cheapest VPS service provider you can find at €3 per year. What’s the catch? Expect zero support and if shit happens and the server fails for whatever reason, they will not be responsible for any data loss.

With that said, this is the absolutely a great option for anyone who’s trying to familiarise and figure out how to manage their own Linux server.

At the end of this tutorial, the beginner will be able to host a basic PHP application setup on the domain of their choice.

For reference, DNS is managed via Cloudflare and hosting is purchased from MrVM (CentOS).

  1. Add the following records to your domain:

    Record type: A

    Name: example.com

    Value: [External IP]

    TTL: Automatic

    Record type: CNAME

    Name: www

    Value: example.com

    TTL: Automatic

  2. Add the following Domain Forwarding under the Client Area:

    Protocol: HTTP

    Source Domain/IP: example.com

    Source Port: 80

    Destination IP: [Primary IP]

    Destination Port: 80

  3. SSH:

    ssh [User]@[External IP] -p [SSH Port]

  4. Install nginx:

    yum update

    yum install epel-release

    yum install nginx

    systemctl start nginx

    systemctl enable nginx

  5. Install php:

    yum install -y yum-utils

    yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm

    yum-config-manager --enable remi-php72

    yum install -y php72 php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache

    systemctl start php72-php-fpm

    systemctl enable php72-php-fpm

  6. Basic php security config:

    vi /etc/opt/remi/php72/php.ini

    Edit:

    cgi.fix_pathinfo=0

  7. PHP-FPM config:

    vi /etc/opt/remi/php72/php-fpm.d/www.conf

    Edit:

    user = nginx

    group = nginx

    Restart:

    systemctl restart php72-php-fpm

  8. Nginx config:

    vi /etc/nginx/nginx.conf

    Edit:

    location ~ .php$ {

    root /usr/share/nginx/html;

    fastcgi_pass 127.0.0.1:9000;

    fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    include fastcgi_params;

    }

    Test config:

    nginx -t

    Restart:

    systemctl restart nginx

  9. Test php:

    vi /usr/share/nginx/html/info.php

    Edit:

    <?php phpinfo(); ?>

    Visit your domain or IP address /info.php to verify if php is working as intended. Once you’ve done so, delete the file and you’re all done!

06 November 2018

index