Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
340 views
in Technique[技术] by (71.8m points)

ssl - Apache server error: The requested URL /ena/home/home.php was not found on this server

I am running Apache server via AWS: httpd-2.2.34-1.16.amzn1.x86_64

In terms of location, my website root is located here: /var/www/html/ena

Site loads from a virtual directory from: /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
 DocumentRoot /var/www/html/ena
 ServerName enetapplications.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =enetapplications.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]
</VirtualHost>

Site was working until I added SSL via letsencrypt. In the file: /etc/httpd/conf.d/ssl.conf

NameVirtualHost *:443

<VirtualHost *:443>
    DocumentRoot /var/www/html/ena
    ServerName enetapplications.com
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/enetapplications.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/enetapplications.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/enetapplications.com/chain.pem
</VirtualHost>

Let's Encrypt seemed to load fine as I can see the https in the url and that it is a secure connection however somehow while setting up I messed up the path to the website (enetapplications.com) - note it was always in a virtual directory

Please advise on any other information I can add to make this clearer and thanks in advance for the assistance.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

While viewing the error logs, the following log is noted:

[Sun Jan 10 04:57:09 2021] [error] [client 185.104.184.116] File does not exist:
 /var/www/html/ena/ena, referer: https://enetapplications.com/ena/home/home.php 

This is interesting in that the website resides /var/www/html/ena and NOT /var/www/html/ena/ena.

To correct this I adjusted the directory to move root to /var/www/html-ena, copied all files to the new root and changed the configuration files accordingly, so for example /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
 DocumentRoot /var/www/html-ena
 ServerName enetapplications.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =enetapplications.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]
</VirtualHost>

This seemed to work, although somehow when loading the Letsencrypt I fouled up php but that is a different issue that still needs to be fixed, but for now the SSL is working with the adjustment to directory structure.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...