 |
 |
 |
 |
| Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc. |

18th November 2009, 04:51 PM
|
|
Registered User
|
|
Join Date: Jul 2009
Posts: 3

|
|
|
404 Error with Apache on Fedora 12
I am running Fedora 12 32 bit version. I have httpd running, but in a browser when I go to http://localhost, it gives me the apache page. When I put in http://localhost/html, I get a 404 error. In the httpd.conf file for the ServerName, I have localhost:80.
What can I do to get this working? This is way more difficult to setup in Fedora than it is in any other distro that I have used.
Any help would be greatly appreciated.
|

18th November 2009, 05:00 PM
|
|
Registered User
|
|
Join Date: Jun 2006
Age: 23
Posts: 29

|
|
|
I see the DocumentRoot is "/var/www/html", not "/var/www"
perhaps this is the reason?
|

18th November 2009, 05:53 PM
|
|
Clueless in a Cuckooland
|
|
Join Date: Mar 2006
Location: Here now, elsewhere tomorrow.
Posts: 3,923

|
|
Quote:
Originally Posted by tyndallc
I am running Fedora 12 32 bit version. I have httpd running, but in a browser when I go to http://localhost, it gives me the apache page. When I put in http://localhost/html, I get a 404 error. In the httpd.conf file for the ServerName, I have localhost:80.
What can I do to get this working? This is way more difficult to setup in Fedora than it is in any other distro that I have used.
Any help would be greatly appreciated.
|
Your webpages, unless you've set up homedirs (which I doubt since you don't seem knowledgeable enough to do that based on your post), go to /var/www/html/
and you access them through http://localhost/ not http://localhost/html/
|

24th November 2009, 03:34 PM
|
|
Registered User
|
|
Join Date: Jul 2009
Posts: 3

|
|
|
Apache
When it comes to setting up apache on fedora, I am definately not very knowledgeable. I found that Debian was very easy to set it up. What is the easiest way to setup a very basic apache setup? If possible, could you provide steps?
|

24th November 2009, 10:33 PM
|
 |
Registered User
|
|
Join Date: Jun 2006
Location: Texas
Age: 42
Posts: 4,168

|
|
Signallock & Pete explained well.
Let's do a different approach.
Code:
[marc@kiriyamablevins ~]$ cd /var/www/html
[marc@kiriyamablevins html]$ ll
total 16
drwxr-xr-x. 2 root root 4096 2009-02-02 19:58 cronscripts
drwxr-xr-x. 2 root root 4096 2008-08-29 03:02 pdf
drwxr-xr-x. 2 root root 4096 2009-09-08 13:46 resume
drwxr-xr-x. 2 root root 4096 2009-04-07 00:04 scripts
[marc@kiriyamablevins html]$
Open your browswer to:
http://kiriyamablevins.dyndns.org/pdf
That is the same location cause my DocumentRoot is set to /var/www/html
Since /var is root ownership. You could 'su -' and copy the files over to /var/www/html.
Edit: Don't worry about your knowledge level of Fedora. You will pick it up in time.
Let us know if you got stuck on something, we are willing to help you.
Last edited by marcrblevins; 26th November 2009 at 05:50 AM.
Reason: Signallock
|

26th November 2009, 04:56 AM
|
|
Registered User
|
|
Join Date: Jun 2006
Age: 23
Posts: 29

|
|
Quote:
Originally Posted by tyndallc
When it comes to setting up apache on fedora, I am definately not very knowledgeable. I found that Debian was very easy to set it up. What is the easiest way to setup a very basic apache setup? If possible, could you provide steps?
|
I think the difference between Apache on Debian and Apache on Fedora is not the software itself, it's the default configuration. Maybe (I'm not familiar with Debian) on Debian, the default DocumentRoot is "/var/www", and it's "/var/www/html" on Fedora. The only important thing to do is reading Apache configuration file. The location is "/etc/httpd/conf/httpd.conf" on Fedora. There you will see DocumentRoot, Port, VirtualHost and many other configurations.
Well the easiest way, first install Apache:
# yum install httpd
Then start the service:
# /etc/init.d/httpd start
By default, httpd will listen port 80, and serve the default directory "/var/www/html", so you can add your index.html to the directory :-)
Last edited by signallock; 26th November 2009 at 10:05 AM.
|

26th November 2009, 05:11 AM
|
 |
Registered User
|
|
Join Date: Jun 2006
Location: Texas
Age: 42
Posts: 4,168

|
|
Correction:
I believe you really have to open port 80 first in system-config-firewall. Iptable off at install time?
Start your terminal:
Code:
su -
system-config-firewall
Open 80 and 443 is planned to use secured http.
|

25th December 2009, 08:05 PM
|
 |
Banned
|
|
Join Date: Jul 2006
Location: Transgression
Age: 33
Posts: 1,183

|
|
If you already have your files under /var/www/html and you're still getting a 404 then you've failed to change your /etc/httpd/conf/httpd.conf setting that specifies what type of file you're using for your index file. I know this because if you HAD an index.htm or index.html the default apache config would pick it up. If i'm wrong, then i'm a jackass  . So, if you're using php files, then you need to add "index.php" before "index.html" in your httpd.conf.
If you're getting a 403 (forbidden) then you need to go to system > seLinux configuration, then select the boolean tab, and then filter by "apache", then select "allow.......... oh wait, i just went to look, and it appears it is not needed any more (i just upgraded from 10 to 12, sorry). Ok, if you're getting a 403 you still need to do:
chcon -Rv -usystem_u -robject_r -thttpd_sys_content_t /var/www/html
that -Rv might be -Rc now......
|

8th January 2010, 06:40 AM
|
|
Registered User
|
|
Join Date: Dec 2009
Location: Mexico City
Posts: 1

|
|
|
I'm new with fedora, this last line solve my problem but I don't get exactly what it does, I've read the --help option but still don't figure out what does "-usystem_u -robject_r -thttpd_sys_content_t /var/www/html", could you explain it to me or tell me where to find more information??
|

8th January 2010, 06:43 AM
|
 |
Banned
|
|
Join Date: Jul 2006
Location: Transgression
Age: 33
Posts: 1,183

|
|
|
Well, i'm not an SE Linux guru, but i always find a way to work WITH it, instead of turning it off.
That command's first 2 flags are common to a lot of SE contexts, but the last 1 (-t) tells SE Linux that the context is to be set as a web server allowed file / content (hence the httpd_sys part). That way, SE Linux will allow the web server (httpd) to access it.
I'm sure that someone else more experienced with SE Linux will come along and explain what i can't.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 14:17 (Tuesday, 21-05-2013)
|
|
 |
 |
 |
 |
|
|