Skip to content

Commit

Permalink
If 443 is disabled and proxy mode is enable, provide a valid vhost
Browse files Browse the repository at this point in the history
* Target a valid vhost when mod_ssl is disabled
  • Loading branch information
camlafit committed Aug 30, 2024
1 parent a506ac7 commit 761bd23
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/etc/alternc/templates/3.5/apache2/php-fpm-https.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
<Virtualhost *:80>
ServerName %%fqdn%%
DocumentRoot "%%document_root%%"
AssignUserId #%%UID%% #%%GID%%
SetEnv LOGIN "%%UID%%-%%LOGIN%%"
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

KeepAlive Off

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !/cgi-bin/
RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L]

<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php%%PHPVERSION%%-%%LOGIN%%.sock|fcgi://localhost"
</FilesMatch>

RewriteEngine on
RewriteCond %{QUERY_STRING} (%2d|-)d.*auto_prepend [NC]
RewriteRule .? - [F,L]

<Directory "%%document_root%%">
require all granted
php_admin_value open_basedir "%%document_root%%:/usr/share/php/:/var/alternc/tmp:/tmp"
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes Options=All,MultiViews
php_admin_flag engine off
</Directory>

# If you want to log the errors also in /var/log/alternc/sites/
# WARNING: this WILL FORK a vlogger for EACH VHOST havingg this !!! the load on the machine may be high
# on hosting with many vhosts. as a consequence, this is disabled by default
Expand Down

0 comments on commit 761bd23

Please sign in to comment.