[Solved] Apache2 websites subfolders getting a 404 error

New to Debian (Or Linux in general)? Ask your questions here!

[Solved] Apache2 websites subfolders getting a 404 error

Postby anca » 2018-10-07 17:03

Hello,
I m running a raspberry using raspbian with a apache2 webserver. I have 2 websites on this server and i can access the main directory of both websites (with index.html). i have used certbot for ssl and i m redirecting all trafic to 443. So far everything was great but then i created a sub folder on one of my webiste so i can build a php forum from scratch to learn php and mysql with mariadb. And i m getting a 404 error. I have checked the permission and to be sure it was fine :
Code: Select all
sudo chgrp www-data /var/www


Here is the conf for one of my website :
Code: Select all
<VirtualHost *:80>

    ServerName example.com
    ServerAlias www.example.com

    RewriteEngine on
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

</VirtualHost>

<VirtualHost *:443>

    ServerName example.com
    ServerAlias www.example.com

    DocumentRoot /var/www/example.com

    <Directory /var/www/example.com>
        Options -Indexes
        AllowOverride all
        Order allow,deny
        allow from all
    </Directory>

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/www.example.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/www.example.com/chain.pem
    SSLProtocol all -SSLv2 -SSLv3
    SSLHonorCipherOrder on
    SSLCompression off
    SSLOptions +StrictRequire
    SSLCipherSuite *********************************************************************
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

    LogLevel warn
    ErrorLog ${APACHE_LOG_DIR}/www.example.com-error.log
    CustomLog ${APACHE_LOG_DIR}/www.example.com-access.log combined

</VirtualHost>


i have tryed everything but the right thing (obviously) and it s time to ask for help if anyone have time for it. English is not my native language but i will try my best to understand what you re saying and i will provide any informations that will help you to help me ;)
Hope we ll fix this
thanks for reading me

ps: last raspbian based on debian 9, update & upgrade done)
Last edited by anca on 2018-10-14 04:53, edited 1 time in total.
User avatar
anca
 
Posts: 3
Joined: 2018-10-07 16:47

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby kopper » 2018-10-08 08:08

You'll get better support at Rasbian forums.

Rasbian is not Debian.
Debian 9.5 Stable with i3
Secure your stuff: Securing Debian Manual
Don't break your stuff: Source List Management DontBreakDebian
kopper
 
Posts: 126
Joined: 2016-09-30 14:30

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby dilberts_left_nut » 2018-10-08 08:25

What do your logs tell you?
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4887
Joined: 2009-10-05 07:54
Location: enzed

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby anca » 2018-10-09 08:45

kopper wrote:You'll get better support at Rasbian forums.

Rasbian is not Debian.


Hello,
Raspbian is a debian build no?



dilberts_left_nut wrote:What do your logs tell you?


Hello,
Here the log i just get with tail @ /var/log/apache2/access.log

Code: Select all
 - - [09/Oct/2018:09:31:26 +0000] "GET /forum/index.php HTTP/1.1" 404 690 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0"
User avatar
anca
 
Posts: 3
Joined: 2018-10-07 16:47

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby GarryRicketson » 2018-10-09 09:40

Hello,
Raspbian is a debian build no?

No it isn't . Here is a list of all the Debian releases:
https://www.debian.org/releases/

No "raspian" listed. I think you are confused, they (the developers at Raspbian )might have used a Debian base, to build another Distribution, and named it Raspbien, but once the base has been modified , it is no longer a Debian release, it is a release (distro) built and produced by others , so that is why you should be asking them, they know what changes have been made, etc.
User avatar
GarryRicketson
 
Posts: 5133
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby dilberts_left_nut » 2018-10-09 10:13

404 means 'not found' for %webroot%/forum/index.php
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4887
Joined: 2009-10-05 07:54
Location: enzed

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby debiman » 2018-10-09 18:24

anca wrote:Here the log i just get with tail @ /var/log/apache2/access.log

this is not a valid unix command.
please be precise.
and why only one line? tail defaults to 10 iirc.
anyhow, with this little information the most likely explanation is still a permission issue (since you say the files are where they're supposed to be).
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby anca » 2018-10-14 04:53

Hey thanks for the support, much appreciated.


I have two websites on my raspberry: website1 with sub directory not working and the reason i asked for help here.
i don t like being stuck and waiting for help so i keep looking and i checked the website2 and sub directory were fine...
I m sorry i didn t check that website before asking for help and i m sorry i wasted your time.

It was indeed a permission issue
Since sub directory and files was there it had to be a file.conf issue (imo)
website1 had two conf file @ /etc/apache2/sites-enabled : website1.conf and website1-le-ssl.conf
when website2 had only one (website2.conf) so i commented website1-le-ssl.conf
then i
Code: Select all
apache2ctl configtest
, got an ok, restarted apache et voila :)

i wonder where this website1-le-ssl.conf come from

Again thanks
User avatar
anca
 
Posts: 3
Joined: 2018-10-07 16:47

Re: [raspbian] Apache2 websites subfolders getting a 404 err

Postby kedaha » 2018-10-14 09:47

anca wrote:i wonder where this website1-le-ssl.conf come from

It comes from running letsencrypt
if it is not enabled and configured then you won't get https
Mate DE & OSSv4.
LaMp, WordPress; ispmail
Debian Stable

Words, as is well known, are the great foes of reality. Joseph Conrad.
Kedaha's Conjecture
User avatar
kedaha
 
Posts: 2868
Joined: 2008-05-24 12:26

Re: [Solved] Apache2 websites subfolders getting a 404 error

Postby debiman » 2018-10-14 13:12

this is the first time i see proof (other than on my own system) that letsencrypt is messing with people's servers.

all that security talk, and then you're expected to just run some unknown python script with root privileges, that you KNOW messes around at the very heart of your server, every 3 months...
:roll:
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable