You are not logged in.

#1 2017-10-16 16:01:01

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

[SOLVED] Getting 404 error after installing Apache

Hello everyone !

I just got a brand new archlinux system which i am very proud of (as usual).
I wanted to have a localhost because I need a LAMP environment. So i went on the wiki, followed the steps happilly, tweaking options here and there, started every services i could think of, and went to http://localhost to see the results.

How disappointed i was, seeing it was not working ! Http.service is running smoothly, but http://localhost gives me a 404 error. Not 403, just 404. Freaking weird, isn't it ?
I've looked around in my configs to understand what i did wrong, i googled it and search on this forum, but i didn't not find any lead useful.

I love archlinux, but i'm still not very experimented with it, so i must have forgottent something somewhere. Could you help me figure out what went wrong ?
Here are some clues :

  • I tried setting up some virtual hosts

  • While trying to use /home/myusername/web as Document root, i may have messed up some file permission

  • I was confident i could set this up, so i didnt keep any record of what operations i attempted (sorry... :-( )

Here are some pastebins of the config files i think are important.

/etc/httpd/conf/httpd.conf
https://pastebin.com/Y0V8XnyG

/etc/hosts
https://pastebin.com/dNddPeLs

Also, here are the results of the following commands :

# ls -la /srv
total 16
drwxr-xr-x  4 root root 4096 Oct 16 18:28 .
drwxr-xr-x 17 root root 4096 Sep 26 18:02 ..
drwxr-xr-x  2 root root 4096 Oct  1 15:18 ftp
drwxr-xr-x  2 root root 4096 Oct 16 18:28 http

If you could help me figure out what i did wrong, i would be most grateful.
If i have to reset evry config file, that's fine. Just tell me how to do that, because i didnt really get that either.

Anyway, thanks for reading !
Cheers,

EDIT : the solution to my problem

In the end, we found out i made a mistake while trying to configure a virtual host. I must have misread the wiki, and did not create directories as i should have.
Localhost was trying to serve one of these virtual hosts but failed to do so, independently of what i put in /srv/http (which, once again, should not have been the case).
seth pointed out i should try to disable vhosts, and that solved it ! I will have to retry configuring these puppies, but for now, my LAMP is lit.

Thanks again for your hard work and reading !
Cheers,

Last edited by Jacka (2017-10-18 08:19:04)

Offline

#2 2017-10-16 16:38:07

seth
Member
Registered: 2012-09-03
Posts: 49,985

Re: [SOLVED] Getting 404 error after installing Apache

ls -l /srv/http

?

Offline

#3 2017-10-16 17:13:34

ackt1c
Banned
From: Visalia, California
Registered: 2012-10-10
Posts: 241

Re: [SOLVED] Getting 404 error after installing Apache

Difficult

Last edited by ackt1c (2022-11-05 12:47:23)

Offline

#4 2017-10-17 04:27:11

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Getting 404 error after installing Apache

Thanks for your replies,

seth wrote:
ls -l /srv/http

?

I've put a basic html template there and named it index.html, but that didn't solve it : i still have the 404 Error


ackt1c wrote:

When I ran apache i had to chown/chgrp to http of my documentroot if I remember correctly.

I thought of that too, but if they were set wrongly, wouldn't i get a "403 : access forbidden" error ? The weird thing is i get a "404 : file not found" error.
In any case, i did this :

# chmod -R +rwx /srv/http/
# ls -la /srv/http/
total 12
drwxr-xrwx 2 root root 4096 Oct 17 07:19 .
drwxr-xr-x 4 root root 4096 Oct 16 18:28 ..
-rwxr-xrwx 1 root root  458 Oct 17 07:19 index.html

But i still get the 404 error.

Last edited by Jacka (2017-10-17 04:28:24)

Offline

#5 2017-10-17 04:33:17

seth
Member
Registered: 2012-09-03
Posts: 49,985

Re: [SOLVED] Getting 404 error after installing Apache

What if you explicitly call "http://localhost/index.html"?
Also try re-owning the documentroot to http.

Otherwise it's time to look into the https://wiki.archlinux.org/index.php/Ap … s_and_Logs

Offline

#6 2017-10-17 11:49:07

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Getting 404 error after installing Apache

So i did just that.

1. Explicitly asking for localhost/index.html gave me the same 404 error.
2. I re-owned the directory to http, didn't change the result but still feels more right tongue

3. the logs look weird to me, i'm not sure i understand what it means but it seems to point out that a directory is missing somewhere... Please have a look :

/var/log/httpd/error_log :

AH00112: Warning: DocumentRoot [/etc/httpd/docs/dummy-host.example.com] does not exist
[Mon Oct 16 18:36:28.071050 2017] [mpm_prefork:notice] [pid 14758] AH00163: Apache/2.4.28 (Unix) PHP/7.1.10 configured -- resuming normal operations
[Mon Oct 16 18:36:28.071135 2017] [core:notice] [pid 14758] AH00094: Command line: '/usr/bin/httpd -D FOREGROUND'
/var/log/httpd/dummy-host.example.com-access_log   

::1 - - [16/Oct/2017:18:36:39 +0300] "GET / HTTP/1.1" 404 1018
::1 - - [16/Oct/2017:18:37:19 +0300] "OPTIONS * HTTP/1.0" 200 -
::1 - - [16/Oct/2017:18:37:20 +0300] "OPTIONS * HTTP/1.0" 200 -
::1 - - [17/Oct/2017:07:17:52 +0300] "GET / HTTP/1.1" 404 1018
::1 - - [17/Oct/2017:07:17:53 +0300] "GET /favicon.ico HTTP/1.1" 404 1137
::1 - - [17/Oct/2017:07:19:14 +0300] "GET / HTTP/1.1" 404 1018
::1 - - [17/Oct/2017:07:21:32 +0300] "GET / HTTP/1.1" 404 1018
::1 - - [17/Oct/2017:14:25:22 +0300] "GET /index.html HTTP/1.1" 404 1018
::1 - - [17/Oct/2017:14:25:22 +0300] "GET /favicon.ico HTTP/1.1" 404 1157
::1 - - [17/Oct/2017:14:30:20 +0300] "GET /index.html HTTP/1.1" 404 1018

Offline

#7 2017-10-17 15:01:34

seth
Member
Registered: 2012-09-03
Posts: 49,985

Re: [SOLVED] Getting 404 error after installing Apache

That's from the "Include conf/extra/httpd-vhosts.conf" line - which should be commented.
If that's not it, can you please paste the entire log after attempting to access the server?

Offline

#8 2017-10-18 08:14:12

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Getting 404 error after installing Apache

seth wrote:

That's from the "Include conf/extra/httpd-vhosts.conf" line - which should be commented.

That was it ! I feel so dumb, i must have misconfigured one of the vhosts i tried to set up. I'll try again sometimes, but for now, my problem is solved !

That really was a stupid error, i apologize for taking so much of your time on that one... Thanks again for your efforts !
Marked [SOLVED] smile

Last edited by Jacka (2017-10-18 08:20:25)

Offline

Board footer

Powered by FluxBB