Example Web Server configs

Here are a few example configs for the Apache and nginx web servers, these are just examples and are not recommended for all use cases.

nginx

Solder server block config

server {
    listen 80; #IPv4
    listen [::]:80; #IPv6

    # Host that will serve this project
    server_name solder.example.com;

    # Access and error logs
    access_log  /var/log/nginx/solder.example.com_access.log;
    error_log   /var/log/nginx/solder.example.com_error.log;

    # The location of Solder's public directory
    root  /var/www/solder/TechnicSolder/public;
    index index.php;

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

    # PHP FPM configuration
    location ~* \.php$ {
        fastcgi_pass                  unix:/run/php/php8.4-fpm.sock;
        fastcgi_index                 index.php;
        fastcgi_split_path_info       ^(.+\.php)(.*)$;
        include                       fastcgi_params;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        # If you're behind a load balancer that terminates TLS connections, then uncomment the next line:
        #fastcgi_param HTTPS on;
    }

    # Disable .htaccess and other hidden files
    location ~ /\.(?!well-known).* {
        deny all;
        access_log off;
        log_not_found off;
        return 404;
    }
    
    # Set header expirations on per-project basis
    location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
        expires 365d;
    }
}

Repo server block config

server {
    listen 80; #IPv4
    listen [::]:80; #IPv6

    # Host that will serve this project
    server_name repo.example.com;

    # Access and error logs
    access_log  /var/log/nginx/repo.example.com_access.log;
    error_log   /var/log/nginx/repo.example.com_error.log;

    # The location of repo directory
    root  /var/www/repo;

    location / {
        try_files $uri $uri/ =404;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }
    
    # Disable .htaccess and other hidden files
    location ~ /\.(?!well-known).* {
        deny all;
        access_log off;
        log_not_found off;
        return 404;
    }
}

Apache

Solder vhost config

<VirtualHost *:80>
    # Host that will serve this project
    ServerName solder.example.com
    ServerAdmin [email protected]
    
    # The location of public directory
    DocumentRoot /var/www/html/TechnicSolder/public/

    # Important options for solder public directory
    <Directory /var/www/html/TechnicSolder/public>
        Options FollowSymLinks
        AllowOverride All
        
        # requires mod_version
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </Directory>

    # Access and error logs
    ErrorLog ${APACHE_LOG_DIR}/solder_error.log
    CustomLog ${APACHE_LOG_DIR}/solder_access.log combined
</VirtualHost>

🚧

If the site is inaccessible

Do not modify DocumentRoot to append /index.php . Read the "Rewrite Engine on Apache" section below.

Repo vhost config

<VirtualHost *:80>
    # Host that will serve this project
    ServerName repo.example.com
    ServerAdmin [email protected]
    
    # The location of repo directory
    DocumentRoot /var/www/html/repo/

    # Important options for solder repo directory
    <Directory /var/www/html/repo>
        Options +Indexes +FollowSymLinks
        AllowOverride All

        # requires mod_version
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </Directory>

    # Access and error logs
    ErrorLog ${APACHE_LOG_DIR}/solder_repo_error.log
    CustomLog ${APACHE_LOG_DIR}/solder_repo_access.log combined
</VirtualHost>

Rewrite Engine on Apache

If you don't have Rewrite Engine on your Apache web server, you need to use a URL with index.php after the domain name.

If you want a clean URL, install Rewrite Engine on your Apache web server and use the configuration provided above so your server uses the .htaccess file correctly and enable Rewrite Engine for your Solder, so you can access to your Solder without index.php.