LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-30-2009, 07:02 AM   #1
wakkana12
Member
 
Registered: Dec 2009
Posts: 171

Rep: Reputation: 15
Question localhost only displays blank page in apache


good day everyone.. just wanna ask you guys something.. yesterday my apache is working fine and i even tested it with a page having php_info(); function and it works.. however when i tried adding a virtual host in my /etc/httpd/extra/httpd-vhost it didnt worked.. then i tried to restart my apache and it returned error saying this
Code:
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
i fixed it by adding a ServerName on my /etc/httpd/httpd.conf and restart my apache but it still displays blank page and now even if i use localhost its still blank.. i tried running a page having php_info(); function but its also blank.. how do i fix it?

and does
Code:
etc/rc.d/rc.httpd restart
different from
Code:
usr/sbin/apachectl restart
 
Old 12-30-2009, 09:00 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by wakkana12 View Post
good day everyone.. just wanna ask you guys something.. yesterday my apache is working fine and i even tested it with a page having php_info(); function and it works.. however when i tried adding a virtual host in my /etc/httpd/extra/httpd-vhost it didnt worked.. then i tried to restart my apache and it returned error saying this
Code:
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
i fixed it by adding a ServerName on my /etc/httpd/httpd.conf and restart my apache but it still displays blank page and now even if i use localhost its still blank.. i tried running a page having php_info(); function but its also blank.. how do i fix it?

and does
Code:
etc/rc.d/rc.httpd restart
different from
Code:
usr/sbin/apachectl restart
in your httpd.conf you will need some lines that include and load php module.

something like

LoadModule php5_module modules/libphp5.so

and

AddHandler php5-script .php
AddType text/html .php

and possibly

DirectoryIndex blablah.php





this is configuration taken from a centos box, but i cant imagine slackware being that different..
with centos and php, the php.conf file is located in conf.d and everything in conf.d is included in the httpd.conf file.
hope this makes sense to you...
 
Old 12-30-2009, 09:19 AM   #3
mattca
Member
 
Registered: Jan 2009
Distribution: Slackware 14.1
Posts: 333

Rep: Reputation: 56
i had this problem too. in order to set up virtual hosts in apache you need to configure localhost as the default virtual host - what apache will serve if no other hosts match.

here are the relevant parts from my extra/httpd-vhosts.conf file:

Code:
<Directory "/var/www/vhosts">
    AllowOverride All
    Order Deny,Allow
    Allow from all
</Directory>

<Directory "/var/www/htdocs">
    AllowOverride All
    Order Deny,Allow
    Allow from all
</Directory>

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    DocumentRoot /var/www/htdocs
    ServerName localhost
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access_log common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/vhosts/<removed>
    ServerName <removed>
    ServerAlias <removed>
    ErrorLog /var/log/httpd/<removed>
    CustomLog /var/log/httpd/<removed> common
</VirtualHost>
 
Old 12-30-2009, 09:58 AM   #4
wakkana12
Member
 
Registered: Dec 2009
Posts: 171

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by centosboy View Post
in your httpd.conf you will need some lines that include and load php module.

something like

LoadModule php5_module modules/libphp5.so

and

AddHandler php5-script .php
AddType text/html .php

and possibly

DirectoryIndex blablah.php





this is configuration taken from a centos box, but i cant imagine slackware being that different..
with centos and php, the php.conf file is located in conf.d and everything in conf.d is included in the httpd.conf file.
hope this makes sense to you...
yesterday my apache works fine w/o those codes.. may i ask why is that possible?
 
Old 12-30-2009, 10:11 AM   #5
wakkana12
Member
 
Registered: Dec 2009
Posts: 171

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by mattca View Post
i had this problem too. in order to set up virtual hosts in apache you need to configure localhost as the default virtual host - what apache will serve if no other hosts match.

here are the relevant parts from my extra/httpd-vhosts.conf file:

Code:
<Directory "/var/www/vhosts">
    AllowOverride All
    Order Deny,Allow
    Allow from all
</Directory>

<Directory "/var/www/htdocs">
    AllowOverride All
    Order Deny,Allow
    Allow from all
</Directory>

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    DocumentRoot /var/www/htdocs
    ServerName localhost
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access_log common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/vhosts/<removed>
    ServerName <removed>
    ServerAlias <removed>
    ErrorLog /var/log/httpd/<removed>
    CustomLog /var/log/httpd/<removed> common
</VirtualHost>
tnx m8.. works fine! will give you thnx.. ^^ though i have to omit the second part w/c has this part
Code:
<VirtualHost *:80>
    DocumentRoot /var/www/vhosts/<removed>
    ServerName <removed>
    ServerAlias <removed>
    ErrorLog /var/log/httpd/<removed>
    CustomLog /var/log/httpd/<removed> common
</VirtualHost>
when i restart my rc.httpd it says that /var/www/vhost cannot be deleted coz it doesnt exist.. what this part by the way?
 
Old 12-30-2009, 10:14 AM   #6
AlvaroG
Member
 
Registered: Jul 2009
Location: Canelones, Uruguay
Distribution: Slackware
Posts: 147

Rep: Reputation: 43
Check the Apache access log (/var/log/httpd/access_log). If you have an entry there for the requests you are making, I'd rule out Apache as the source of the problem.

Also check the server log (/var/log/httpd/error_log). Maybe you are having a PHP error that is not being shown due to the error_reporting value. But if log_errors is enabled (that is the name of the property in php.ini, IIRC) you should have the error logged in that file.

Also, what happens if you try...?
- load a static, plain HTML page
- run a PHP file from the command line


Edit: too late, but good that you found a solution :-)

Last edited by AlvaroG; 12-30-2009 at 10:18 AM.
 
Old 12-30-2009, 10:17 AM   #7
mattca
Member
 
Registered: Jan 2009
Distribution: Slackware 14.1
Posts: 333

Rep: Reputation: 56
Quote:
Originally Posted by wakkana12 View Post
when i restart my rc.httpd it says that /var/www/vhost cannot be deleted coz it doesnt exist.. what this part by the way?
that's because the config i posted is specific to my system, and i have all my vhosts in /var/www/vhosts. you'll have to change it to match your system.

and, no problem glad it helped!

[edit: and the <removed> part is the server name that i'd like to keep private. customize to match your vhost.]

Last edited by mattca; 12-30-2009 at 10:22 AM.
 
Old 12-30-2009, 08:06 PM   #8
wakkana12
Member
 
Registered: Dec 2009
Posts: 171

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by mattca View Post
that's because the config i posted is specific to my system, and i have all my vhosts in /var/www/vhosts. you'll have to change it to match your system.

and, no problem glad it helped!

[edit: and the <removed> part is the server name that i'd like to keep private. customize to match your vhost.]
so that second part is used to remove the virtual host? i mean it would delete the file?
 
Old 12-31-2009, 01:08 PM   #9
mattca
Member
 
Registered: Jan 2009
Distribution: Slackware 14.1
Posts: 333

Rep: Reputation: 56
Quote:
Originally Posted by wakkana12 View Post
so that second part is used to remove the virtual host? i mean it would delete the file?
no, nothing in apache config should delete files that i know of.
 
Old 01-02-2010, 02:27 AM   #10
wakkana12
Member
 
Registered: Dec 2009
Posts: 171

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by mattca View Post
no, nothing in apache config should delete files that i know of.
hmmmm.. then whats the use of the second part?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ubuntu Server edition 9.10, http://localhost/phpmyadmin = blank white page in browser VipX1 Linux - Server 13 12-19-2009 10:29 AM
Apache displays start page in Hebrew rcschroeder Slackware - Installation 1 01-12-2007 07:25 PM
Mplayer displays blank screen jwijesundra Linux - Software 5 09-17-2004 07:06 PM
Apache blank screen at http://localhost/ Steel Shepherd Linux - Software 9 04-10-2004 02:39 AM
man - displays blank pages schurt Slackware 3 03-05-2004 06:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration