0

I can view a directory of my LAMP server running on Ubuntu 20.04 over my LAN using my mobile phone's web browser, when I type http://192.168.X.XXX. However, I can not access any of the sites/directories if I click on them.

This is expected behavior as I have a self-signed OpenSSL certificate on the LAMP, but I also have a 000-default.conf apache config

When I type https://192.168.X.XXX I correctly get denied access.

My question is:
What do I need to do to make local LAMP server url's available over LAN for testing?

For example, I would like to access.

https://localhost.devsite.com from my mobile phone, also a nextcloud server installation as well.

In a nutshell, my phone can "see" the LAMP server on LAN, but not the actual websites on the LAMP server..

What gives?

My wordpress install(s) has:

<VirtualHost *:443>

    ServerName localhost.someothersite.org
    ServerAlias www.localhost.someothersite.org
    
    # If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.

    ServerAdmin info@someothersite.org

    ErrorLog ${APACHE_LOG_DIR}/localhost.someothersite.org.error.log
    CustomLog ${APACHE_LOG_DIR}/localhost.someothersite.org.access.log combined

    DocumentRoot /var/www/html/someothersite.org
    
    <Directory /var/www/html/someothersite.org>
        Options None FollowSymLinks
        # Enable .htaccess Overrides:
        AllowOverride All
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /var/www/html/someothersite.org/wp-content>
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
            
    SSLEngine on
   SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
   SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

</VirtualHost>

My nextcloud install has:

<VirtualHost *:443>
  DocumentRoot /var/www/html/nextcloud/
  ServerName  nextcloudinstall.org

  <Directory /var/www/html/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
    Satisfy Any

    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>

My Hosts file has:

127.0.0.1   nextcloudinstall.org
127.0.0.1   localhost.someothersite.org
0

Websites by name can be only accessed in they resolve properly in DNS, and they are setup as virtualhosts. If you would like to just see your one website via IP it will look into default folder defined under /etc/httpd/conf/httpd.conf

DocumentRoot "/var/www/html"

This direction. If you are getting access denied please check folder user rights, and make sure that apache user and group have access to this folder, and of course that it exists, otherwise apache my just show generic welcome message, not in this folder.

So to work with website name, you have to setup your DNS server so that localhost.devsite.com points to your IP and also use same DNS when searching this domain name from your client, namely mobile phone or other computer.

4
  • Thx for the reply... I added more info.. can you be a little more specific about what I need to change so that I can access the the urls via my mobile?
    – yupthatguy
    Feb 8 at 12:43
  • Specifically, how do I edit the DNS server for Ubuntu 20.04?
    – yupthatguy
    Feb 8 at 12:55
  • @yupthatguy do you have DNS running as server on your Ubuntu? If you don't install it and look through docs, for simple setup of zones. Very popular DNS is bind if you install via packagemanager is also called named From what I've seen in you httpd.conf you need to add extra directive DocumentRoot outside of VirtualHost in order to see your website called with IP.
    – DenisZ
    Feb 8 at 15:05
  • thx for the reply. I use a nordvpn DNS address and wanted to find a less "heavy" solution as DNS as a server. I think I found a good solution in the Ubuntu server docs.. check out the question that I just posted.. maybe you know the answer? It should be simple.. unix.stackexchange.com/questions/633342/…
    – yupthatguy
    Feb 8 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.