SpaceCore WIKI
English
English
  • Personal Account and Registration
    • Account registration
    • «Customer» section
    • «Finance» section
    • Account Verification (KYC)
  • Customer service
    • How do I place an order?
    • How to contact support?
    • The Game Hosting panel
    • Setting Up BILLmanager 6 for Reselling
  • Communications
    • Notifications in Telegram
    • Web Hosting Notifications
    • Using a ping bot in Telegram
  • Information board
    • Blocked ports (VPS/VDS)
    • What is IOPS?
    • VAT for the EU and UK
  • VPS and Dedicated Servers
    • How to use VPS/VDS?
    • Changing the Password for VDS
  • OS and software configuration
    • Java [Linux]
    • Screen
    • Linux Password Recovery
    • Connecting via SSH keys
    • Disabling access to Linux using a password
    • Deploying MikroTik RouterOS on VDS
  • AI
    • Deploying DeepSeek on your server in just a few clicks
  • Windows
    • RDP connection
    • Configuring the RDP connection
    • Changing the password
    • Installation via QEMU
    • How to add an IPv4
    • Download files
    • Bruteforce Windows
  • Network Setup and Security
    • No interaction with private networks
    • Working with TCPDump
    • Change MTU Value
    • Configure IPTables
    • [DNS] Temporary failure resolving...
    • Network Speed Measurement [SpeedTest]
    • How do I buy a domain name?
    • How do I direct my domain to an IP address?
    • How to Protect Your Server? Basics of Cybersecurity
  • VPN and Privacy
    • WireGuard VPN [Easy]
    • OpenVPN [Easy]
    • Outline VPN Installation
    • Installing TorrServer
    • Installing 3X UI
    • Installing Marzban
    • Proxy for Specific Websites (V2RayN)
    • Use Nekoray
  • System monitoring
    • Traffic monitoring via VnStat
    • How to use the MTR tool
    • Getting Serial Numbers of Drives
  • Administration and Backups
    • Working with FTP Repository
    • Auto-shipment of backups
    • Installing an FTP Server
    • Mounting Linux Drives
  • Web development
    • Installing Apache2
    • Installing Nginx
    • Installing PHP
    • Installing MySQL
    • Installing PhpMyAdmin
    • Let's Encrypt SSL Generation
  • Minecraft
    • Installing Minecraft Java Server
    • Installing the Minecraft Bedrock/PE server
    • Installing the BungeeCord server
    • Installing Sponge Forge 1.12.2 Kernel
    • Configuring server.properties
    • Installing the icon on the server
    • Launch Options
    • Installing a resource pack on the server
  • Hetzner Servers
    • Control Panel
    • Password change via Rescue
    • Installing the operating system
  • 🇩🇪Contabo
    • The Control Panel
    • Disk space expansion
Powered by GitBook
On this page
  • Installing a Web server
  • Customization Nginx
  • Notes on PHP
  • Connecting an SSL certificate to Nginx
  • Checking for Apache2
  • Removal Nginx

Nginx is a web server with a lot of features, made according to the latest canons of technology. It is used by the largest companies such as VKontakte, Google, Facebook and others.

Before installing, make sure that you do not have Apache2 installed!

Installing a Web server

Its installation is extremely simple, use the following command:

apt-get install nginx -y

Customization Nginx

You need to go to the /etc/nginx/sites-available directory and create a file such as «site.conf».

Paste the following into the config and edit:

site.conf
server {
    listen       *:80;
    server_name  spacecore.pro; # site domain
    client_max_body_size 1000M; # the maximum file size transmitted through the site
    error_page 404 = @notfound;
    location / {
        root   /home/site/spacecore; # the path to the site
        try_files $uri $uri.html $uri/ @extensionless-php;
        index  index.html index.php;
    }
    # Подключения PHP, if you don't need it, then erase lines 13 to 21
    location ~ \.(php|html|htm)$ {
        try_files $uri =404;
        root   /home/site/spacecore; # the path to the site
        fastcgi_pass unix:/run/php/php7.0-fpm.sock; # the path to php
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include /etc/nginx/fastcgi_params;
    }
}

Restarting Nginx:

service nginx restart

Notes on PHP

PHP is not required to work with Nginx. This note is important only for those whose site uses PHP.

Connecting an SSL certificate to Nginx

SSL connection is not required, it is carried out if it is available and you wish.

We need to create or edit a site config to look like this:

server {
    listen 80;
    server_name spacecore.pro; # site domain
    return 301 https://$server_name$request_uri; # redirect from http to https
}

server {
    listen 443 ssl http2;
    server_name spacecore.pro; # site domain

    root /var/www/spacecore; # the path to the site
    index index.html index.htm index.php; # index pages

    access_log /var/log/nginx/spacecore.app-access.log; # logs of successful connections
    error_log  /var/log/nginx/spacecore.app-error.log error; # logs of erroneous connections

    # if you want to disable something, instead of the path to the file write «off»

    client_max_body_size 1000m; # the maximum file size transmitted through the site
    client_body_timeout 120s; # timeout value

    sendfile off; # after enabling, Nginx will send HTTP response headers in a single packet, rather than in separate parts.
    # SSL Configuration
    ssl_certificate /etc/letsencrypt/live/spacecore.pro/fullchain.pem; # the public key of the certificate
    ssl_certificate_key /etc/letsencrypt/live/spacecore.pro/privkey.pem; # the private key of the certificate
    ssl_session_cache shared:SSL:10m; # SSL session cache size
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
    ssl_prefer_server_ciphers on; # reduces the loading time of the site pages

    location ~ \.(php|html|htm)$ {
try_files $uri =404;
root /var/www/spacecore; # the path to the site
fastcgi_pass unix:/run/php/php7.2-fpm.sock; # the path to php
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
    }
}

Rebooting Nginx:

service nginx restart

Checking for Apache2

If Nginx is installed with Apache2, they will conflict due to port 80. So you need to delete one of the Web servers. Check if Apache2 is installed:

service apache2 status

If there is not a huge message with information, then it is not installed.

If Apache2 is installed, you need to remove it:

apt-get remove --purge apache2* -y

Removal Nginx

In order to completely remove Nginx from the server, it must first be stopped:

service nginx stop

And then write a command that will permanently delete it:

apt-get remove --purge nginx*
PreviousInstalling Apache2NextInstalling PHP

Last updated 12 months ago

Additional information can be found .

here