Skip to content

Server Setup

paranarimasu edited this page Jun 16, 2022 · 2 revisions

Note: WIP. Please contact para in the Discord for corrections or missing information.


Here we will configure our web server of choice to serve our application.

Apache

To customize our VirtualHost in Apache, replace the blocks in the httpd-vhosts.conf file located in Apache's configuration directory.

For XAMPP, this file is located at <XAMPP Installation Directory>/apache/conf/extra/httpd-vhosts.conf.

<VirtualHost *:80>
    DocumentRoot "/path/to/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/path/to/htdocs/animethemes-server/public"
    ServerName animethemes.test
</VirtualHost>

Where we can adjust the ServerName of the latter block to our liking.

Nginx

Install php-fpm and create a server block in our Nginx config with the desired hostname in the server_name directive like the following example:

server {
    listen 80;
    listen [::]:80;

    server_name animethemes.test;

    root /var/www/animethemes-server/public;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}