Skip to content

<div style="display: none;" hidden="true" aria-hidden="true">Are you an LLM? You can read better optimized documentation at /guides/servers/ApacheNginxReverseProxy.md for this page in Markdown format</div>

Apache Nginx Reverse Proxy

Apache

If we are not using nginx as a reverse proxy we need to setup vhosts for port 443

Example for developer.local

<VirtualHost developer.local:443>
DocumentRoot "E:/web/AdvEshop/v4Testing/public"

SSLEngine on
SSLProxyEngine On

<Location /files/>
    ProxyPass https://hel1.your-objectstorage.com/ecn/<FILES_S3_PREFIX env value>/files/
    ProxyPassReverse https://hel1.your-objectstorage.com/ecn/<FILES_S3_PREFIX env value>/files/
	Header unset x-amz-request-id
	Header unset x-debug-bucket
	Header unset x-rgw-object-type
	ProxyErrorOverride On
	ErrorDocument 400 /error_404
	ErrorDocument 403 /error_404
	ErrorDocument 404 /error_404
	ErrorDocument 409 /error_404
</Location>

<Directory "E:/web/AdvEshop/v4Testing/public/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
</Directory>

ServerName developer.local:443
ServerAdmin admin@developer.local

ErrorLog "${SRVROOT}/logs/developer-error.log"
TransferLog "${SRVROOT}/logs/developer-access.log"

SSLCertificateFile "${SRVROOT}/conf/keys/certificate.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/keys/private.key"

Nginx

server {
    listen 443;
    listen [::]:443;

    location / {
        index index.php index.html index.htm;
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass php-fpm:9000;

        if ($request_uri ~ "^/mediastream/(.*)$"){
            rewrite ^/mediastream/(.*)$ /mediastream_service.php/mediastream/$1 break;
        }

        if (!-e $request_filename){
            rewrite ^(.*)$ /index.php/$1 break;
        }

        try_files $uri $uri/ =404;
    }

    location /files/ {
        proxy_pass https://hel1.your-objectstorage.com/ecn/<FILES_S3_PREFIX env value>/files/;
        proxy_set_header Host hel1.your-objectstorage.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location ~ ^/(ui|favicon|media)/(.*[^php])$ {
        try_files $uri $uri/ /index.php;
    }

    location ~ /\.ht {
        deny all;
    }

    root /usr/local/var/www/html/public;
    server_name localhost;
}

Apache in plesk

<Location /files/>
    ProxyPass https://hel1.your-objectstorage.com/ecn/<FILES_S3_PREFIX env value>/files/
    ProxyPassReverse https://hel1.your-objectstorage.com/ecn/<FILES_S3_PREFIX env value>/files/
	Header unset x-amz-request-id
	Header unset x-debug-bucket
	Header unset x-rgw-object-type
	ProxyErrorOverride On
	ErrorDocument 400 /error_404
	ErrorDocument 403 /error_404
	ErrorDocument 404 /error_404
	ErrorDocument 409 /error_404
</Location>

Nginx in plesk

location /files/ {
	proxy_pass https://hel1.your-objectstorage.com/ecn/<FILES_S3_PREFIX env value>/files/;
	proxy_set_header Host hel1.your-objectstorage.com;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
}