I have a apache Server version: Apache/2.4.46 on Amazon Linux 2. PHP is working well on port 443. I added another virtualhost on port 81. PHP does not work on this port.
Config:
Listen 80
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName "www.mspvl.in"
ServerAlias "mspvl.in"
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mspvl.in [OR]
RewriteCond %{SERVER_NAME} =mspvl.in
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Listen 81
<VirtualHost *:81>
DocumentRoot "/var/www/html/phpMyAdmin"
ServerName "www.test.in"
ErrorLog /var/log/httpd/vhost81_error_log
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/test.in/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.in/privkey.pem
</VirtualHost>
and ...
<Directory "/var/www/html/phpMyAdmin">
Options Indexes ExecCGI FollowSymLinks MultiViews
AllowOverride All
Require all granted
php_admin_flag engine on
</Directory>
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
<Directory "/var/www/html/phpMyAdmin">
Options Indexes ExecCGI FollowSymLinks MultiViews
AllowOverride All
Require all granted
php_admin_flag engine on
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
IncludeOptional conf.d/*.conf
Include /etc/httpd/conf/httpd-le-ssl.conf
When I access ordinary html files via https://www.test.in:81/test.html, it works. But https://www.test.in:81/test.php produces a 403 Forbidden error.
File permissions:
-rw-r--r-- 1 ec2-user apache 52 Apr 29 08:09 test.html
-rwxr-xr-x 1 ec2-user apache 82 Apr 29 08:49 test.php
Log file : ssl_access_log:
117.232.103.170 - - [29/Apr/2021:17:21:07 +0000] "GET /test.php HTTP/1.1" 403 199 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36"
117.232.103.170 - - [29/Apr/2021:17:21:07 +0000] "GET /favicon.ico HTTP/1.1" 200 22486 "https://www.test.in:81/test.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36"
117.232.103.170 - - [29/Apr/2021:17:21:27 +0000] "-" 408 - "-" "-"
Log file vhost81_error_log:
[Thu Apr 29 17:21:07.128643 2021] [ssl:info] [pid 30312] [client 117.232.103.170:49793] AH01964: Connection to child 2 established (server www.test.in:443)
[Thu Apr 29 17:21:07.128794 2021] [ssl:debug] [pid 30312] ssl_engine_kernel.c(2353): [client 117.232.103.170:49793] AH02043: SSL virtual host for servername www.test.in found
[Thu Apr 29 17:21:07.128807 2021] [core:debug] [pid 30312] protocol.c(2341): [client 117.232.103.170:49793] AH03155: select protocol from h2,h2c,http/1.1, choices=h2,http/1.1 for server www.test.in
[Thu Apr 29 17:21:07.128812 2021] [core:debug] [pid 30312] protocol.c(2386): [client 117.232.103.170:49793] AH03156: select protocol, proposals=http/1.1 preferences=h2,h2c,http/1.1 configured=h2,h2c,http/1.1
[Thu Apr 29 17:21:07.128815 2021] [core:debug] [pid 30312] protocol.c(2404): [client 117.232.103.170:49793] AH03157: selected protocol=http/1.1
[Thu Apr 29 17:21:07.129063 2021] [ssl:info] [pid 30355] [client 117.232.103.170:24820] AH01964: Connection to child 6 established (server www.test.in:443)
[Thu Apr 29 17:21:07.129158 2021] [ssl:debug] [pid 30355] ssl_engine_kernel.c(2353): [client 117.232.103.170:24820] AH02043: SSL virtual host for servername www.test.in found
[Thu Apr 29 17:21:07.129168 2021] [core:debug] [pid 30355] protocol.c(2341): [client 117.232.103.170:24820] AH03155: select protocol from h2,h2c,http/1.1, choices=h2,http/1.1 for server www.test.in
[Thu Apr 29 17:21:07.129172 2021] [core:debug] [pid 30355] protocol.c(2386): [client 117.232.103.170:24820] AH03156: select protocol, proposals=http/1.1 preferences=h2,h2c,http/1.1 configured=h2,h2c,http/1.1
[Thu Apr 29 17:21:07.129175 2021] [core:debug] [pid 30355] protocol.c(2404): [client 117.232.103.170:24820] AH03157: selected protocol=http/1.1
[Thu Apr 29 17:21:07.169292 2021] [ssl:debug] [pid 30312] ssl_engine_kernel.c(2236): [client 117.232.103.170:49793] AH02041: Protocol: TLSv1.2, Cipher: ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
[Thu Apr 29 17:21:07.169657 2021] [ssl:debug] [pid 30355] ssl_engine_kernel.c(2236): [client 117.232.103.170:24820] AH02041: Protocol: TLSv1.2, Cipher: ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
[Thu Apr 29 17:21:07.169832 2021] [ssl:debug] [pid 30355] ssl_engine_kernel.c(383): [client 117.232.103.170:24820] AH02034: Initial (No.1) HTTPS request received for child 6 (server www.test.in:443)
[Thu Apr 29 17:21:07.170097 2021] [authz_core:debug] [pid 30355] mod_authz_core.c(818): [client 117.232.103.170:24820] AH01626: authorization result of Require all granted: granted
[Thu Apr 29 17:21:07.170103 2021] [authz_core:debug] [pid 30355] mod_authz_core.c(818): [client 117.232.103.170:24820] AH01626: authorization result of <RequireAny>: granted
[Thu Apr 29 17:21:07.170131 2021] [headers:debug] [pid 30355] mod_headers.c(900): AH01503: headers: ap_headers_error_filter()
[Thu Apr 29 17:21:07.347851 2021] [ssl:debug] [pid 30355] ssl_engine_kernel.c(383): [client 117.232.103.170:24820] AH02034: Subsequent (No.2) HTTPS request received for child 6 (server www.test.in:443), referer: https://www.test.in:81/test.php
[Thu Apr 29 17:21:07.348136 2021] [authz_core:debug] [pid 30355] mod_authz_core.c(818): [client 117.232.103.170:24820] AH01626: authorization result of Require all granted: granted, referer: https://www.test.in:81/test.php
[Thu Apr 29 17:21:07.348141 2021] [authz_core:debug] [pid 30355] mod_authz_core.c(818): [client 117.232.103.170:24820] AH01626: authorization result of <RequireAny>: granted, referer: https://www.test.in:81/test.php
Please help.
0 Answers