Reputation: 2055
I am running Ubuntu (+LAMP) stack for my webserver. Everything for webserver seems to be working fine. For example I have index.php page with
<?php
phpinfo();
?>
inside /var/www/html & also under /var/www/mytestsite.com/
From inside the webserver, both sites @ http://MyServerIPAddress/hello.php
& http://MyServerIPAddress/mytestsite.com/hello.php
are working showing proper phpinfo.
When I test the same from outside the server, I can only reach page inside /var/www/html
http://MyServerIPAddress/hello.php
But page access to
http://MyServerIPAddress/mytestsite.com/hello.php
Message shows
Not Found
The requested URL /example.com was not found on this server.
Apache/2.4.7 (Ubuntu) Server at *MyServerIPAddress* Port 80.
Here is mytestsite.com.conf I used for apache
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mytestsite.com
ServerAlias www.mytestsite.com
DocumentRoot /var/www/mytestsite.com
</VirtualHost>
And also matched folder access & owner setting to the match for both /var/www/html and /var/www/mytestsite.com
What extra configuration DO I need to be able to access sites outside /var/www/html folder?
Upvotes: 2
Views: 3014
Reputation: 2055
I found the answer to my own question after looking at apache logs and help from others First thing I changed my website's apache conf file to
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mytestsite.com
ServerName <ServerIpAddress>
DocumentRoot /var/www
<Directory /var/www/mytestsite.com/public_html**/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Also I made changes to /etc/hosts file to include include the site as
<localhostIp> localhost
<localhostIp> ubuntu
<ServerIpAddress> mytestsite.com mytestsite.com
After I made the changes, I can access site from outside the server
Upvotes: 1