LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 05-30-2018, 04:41 AM   #1
mahmoodn
Member
 
Registered: May 2010
Posts: 426

Rep: Reputation: 16
Apache doesn't show the page while virtualhost is defined


With Ubuntu 18.04, php7.2 and apache web server, I have defined a virtualhost and put the web files in the correct place.

The content of the config file is

Code:
root@webshob:~# ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 مئی   30 11:57 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 38 مئی   30 12:07 shob.conf -> /etc/apache2/sites-available/shob.conf
root@webshob:~# cat /etc/apache2/sites-available/shob.conf
<VirtualHost *:80>
            ServerAdmin admin@yourdomain.com
            DocumentRoot /var/www/html/shob/
            ServerName your-domain.com
            ServerAlias www.your-domain.com
            <Directory /var/www/html/shob/>
                Options FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all
           </Directory>
           ErrorLog /var/log/apache2/webshob-error_log
           CustomLog /var/log/apache2/webshob-access_log common
</VirtualHost>
root@webshob:~#
And the files are public html folder
Code:
root@webshob:~# ls -l /var/www/html/
total 16
-rw-r--r--  1 root     root     10918 مئی   30 11:57 index.html
drwxr-xr-x 18 www-data www-data  4096 مئی   30 12:08 shob
When I enter http://w.x.y.z in firefox where w.x.y.z is a valid ip, I can see the default apache test page. However when I enter http://w.x.y.z/shob, I get the following error which means I can not see the web installer.

Code:
The requested URL /shob/install was not found on this server.
You ma say that the file doesn't exists! However, I do the following test and it works

In terminal, I run php -S w.x.y.z:8080 and when I enter http://w.x.y.z:8080 I can see the installer. Meanwhile in the terminal, I see

Code:
root@webshob:/var/www/html/shob# php -S w.x.y.z:8080
PHP 7.2.5-0ubuntu0.18.04.1 Development Server started at Wed May 30 13:09:16 2018
Listening on http://w.x.y.z:8080
Document root is /var/www/html/shob
Press Ctrl-C to quit.
[Wed May 30 13:09:20 2018] 5.57.36.99:50254 [301]: /
[Wed May 30 13:09:20 2018] 5.57.36.99:50255 [301]: /install
[Wed May 30 13:09:20 2018] 5.57.36.99:50256 [200]: /install/rules
[Wed May 30 13:09:20 2018] 5.57.36.99:50257 [200]: /ow_install/view/style.css
[Wed May 30 13:09:20 2018] 5.57.36.99:50258 [200]: /ow_install/view/img/logo.png
[Wed May 30 13:09:20 2018] 5.57.36.99:50259 [200]: /ow_install/view/img/header.png
[Wed May 30 13:09:20 2018] 5.57.36.99:50260 [200]: /ow_install/view/img/button.png
So the install files are there. How can I fix that?

Last edited by mahmoodn; 05-30-2018 at 04:43 AM.
 
Old 05-30-2018, 06:39 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,292

Rep: Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697
Quote:
root@webshob:~# ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 مئی 30 11:57 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 38 مئی 30 12:07 shob.conf -> /etc/apache2/sites-available/shob.conf
root@webshob:~# cat /etc/apache2/sites-available/shob.conf
<VirtualHost *:80>sites-available/000-default.conf
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/shob/
ServerName your-domain.com
ServerAlias www.your-domain.com
<Directory /var/www/html/shob/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/webshob-error_log
CustomLog /var/log/apache2/webshob-access_log common
</VirtualHost>
<snip>
When I enter http://w.x.y.z in firefox where w.x.y.z is a valid ip, I can see the default apache test page. However when I enter http://w.x.y.z/shob, I get the following error which means I can not see the web installer.

The requested URL /shob/install was not found on this server.
Using an IP address in your browser, will give you the default apache vhost (defined in sites-available/000-default.conf)
You should use: http://your-domain.com assuming that your-domain.com resolves to your apache server IP.
 
Old 05-30-2018, 11:04 AM   #3
mahmoodn
Member
 
Registered: May 2010
Posts: 426

Original Poster
Rep: Reputation: 16
There is no DNS. So, I must enter the ip address in the browser
 
Old 05-30-2018, 01:04 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,292

Rep: Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697
Quote:
Originally Posted by mahmoodn View Post
There is no DNS. So, I must enter the ip address in the browser
In this case you can add in the client's hosts file (/etc/hosts) the following line:
Code:
w.x.y.z your-domain.com
 
Old 06-03-2018, 07:13 AM   #5
mahmoodn
Member
 
Registered: May 2010
Posts: 426

Original Poster
Rep: Reputation: 16
Quote:
w.x.y.z your-domain.com
No it doesn't help.
I also tried to create a folder in /var/www/html and also creating a file for the virtualhost separately. Still it doesn't work. Please see the new configuration
Code:
root@webshob:/var/www/html# ls shob/
captcha.php       ow_core      ow_libraries    ow_static          ow_utilities
CHANGELOG.txt     ow_cron      ow_log          ow_system_plugins  ow_version.xml
e500.php          ow_iis       ow_pluginfiles  ow_themes          ReadMe.pdf
index.php         ow_includes  ow_plugins      ow_updates         robots.txt
install_info.txt  ow_install   ow_smarty       ow_userfiles       UPDATE.txt
root@webshob:/var/www/html# 
root@webshob:/var/www/html# 
root@webshob:/var/www/html# cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	webshub

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@webshob:/var/www/html# ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 مئی   30 11:57 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 38 مئی   30 12:07 shob.conf -> /etc/apache2/sites-available/shob.conf
root@webshob:/var/www/html# 
root@webshob:/var/www/html# cat /etc/apache2/sites-available/shob.conf 
<VirtualHost *:80>
            ServerAdmin admin@yourdomain.com
            DocumentRoot /var/www/html/shob/
            <Directory /var/www/html/shob/>
                Options FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all
           </Directory>
           ErrorLog /var/log/apache2/webshub-error_log
           CustomLog /var/log/apache2/webshub-access_log common
</VirtualHost>
Now, from a remote machine,

Code:
mahmood@orca:eam$ wget w.x.y.z/shob
--2018-06-03 15:42:10--  http://w.x.y.z/shob
Connecting to w.x.y.z:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://w.x.y.z/shob/ [following]
--2018-06-03 15:42:11--  http://w.x.y.z/shob/
Reusing existing connection to w.x.y.z:80.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://w.x.y.z/shob/install [following]
--2018-06-03 15:42:11--  http://w.x.y.z/shob/install
Reusing existing connection to w.x.y.z:80.
HTTP request sent, awaiting response... 404 Not Found
2018-06-03 15:42:11 ERROR 404: Not Found.
Any idea?

Last edited by mahmoodn; 06-03-2018 at 07:14 AM.
 
Old 06-03-2018, 07:17 AM   #6
mahmoodn
Member
 
Registered: May 2010
Posts: 426

Original Poster
Rep: Reputation: 16
Even running wget localhost/shob from the server (webshob machine), says that the file is nto found

Code:
root@webshob:/var/www/html# wget localhost/shub
--2018-06-03 15:45:42--  http://localhost/shub
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/shub/ [following]
--2018-06-03 15:45:42--  http://localhost/shub/
Reusing existing connection to localhost:80.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/shub/install [following]
--2018-06-03 15:45:42--  http://localhost/shub/install
Reusing existing connection to localhost:80.
HTTP request sent, awaiting response... 404 Not Found
2018-06-03 15:45:42 ERROR 404: Not Found.
 
Old 06-03-2018, 08:44 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,292

Rep: Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697
Quote:
Now, from a remote machine,

mahmood@orca:eam$ wget w.x.y.z/shob
<-snip->
Location: http://w.x.y.z/shob/install [following]
--2018-06-03 15:42:11-- http://w.x.y.z/shob/install
Reusing existing connection to w.x.y.z:80.
HTTP request sent, awaiting response... 404 Not Found
2018-06-03 15:42:11 ERROR 404: Not Found.
You should look at the apache error_log to see what was not found and were apache was looking it for.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Apache Default Index page Not working after VirtualHost Configuration raheel_com88 Linux - Software 3 09-09-2015 03:35 PM
Apache can't show my test page on CentOS 7. hack3rcon Linux - Server 3 08-30-2015 07:20 AM
[SOLVED] apache 2 test page show? fairladyz Linux - Server 7 01-20-2013 08:34 PM
Apache doesn't show my webpage but just the / brisket1 Linux - Server 1 03-03-2012 05:07 PM
Dedicated server problem - HTML page doesn't show anymore prasepretep Linux - Server 1 02-14-2008 03:01 PM

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

All times are GMT -5. The time now is 07:04 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration