If you're setting up just a development machine you don't need outside url's to lead into your machine as you should be developing in such a way that the url doesn't matter. I have multiple projects going at the same time and all of them work fine with no internet connection. This is how I setup my platform.
localhost does not need to have internet to work.
Open your hosts file and add your sites to your development machine.
sudo nano /etc/hosts
For each site you're going to build, add a host record for it like below.
Now in your apache virtual host files you can set them up accordingly.
As an example here is the config file for my elim.localhost site. Which I store as /etc/apache2/sites-available/elim.localhost.conf
after adding this information to the file I issue this command:
sudo a2ensite elim.localhost.conf && sudo service apache2 reload
Now in the browser, access my site I can type:
elim.localhost
I repeat this process for each project. Based on the setup at the time of this post the following urls can be used on my development machine, all going different places.
- elim.localhost
- 18we.localhost
- 29pines.localhost
If you're using phpmyadmin for your work on a mysql database server, localhost/phpmyadmin should still work with no problems.
This is confirmed to work even with the network card disconnected from the network.
A symlink should work fine.
You may or may not need to add the directory to /etc/apache2/apache2.conf
so that apache knows it is allowed to access the non-standard directory.
Example (note: I do not use the -d option):
doug@s15:/var/www/html$ ln -s /media/newhd/test_web bla2
doug@s15:/var/www/html$ ls -l
total 44
...
lrwxrwxrwx 1 doug doug 21 May 11 22:14 bla2 -> /media/newhd/test_web
...
Excerpt from '/etc/apache2/acpahe2.conf'
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /media/newhd/test_web/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Make sure all permissions, including parents, are in order. You can do it manually, directory by directory or:
$ namei -m /media/newhd/test_web
f: /media/newhd/test_web
drwxr-xr-x /
drwsrwsrwt media
drwxr-xr-x newhd
drwxr-xr-x test_web
Now, there are some files systems that do not work with Apache, my example was an ext4 filesystem. And some disks that are automounted (mine is not) need an fstab entry to work properly.
Otherwise help us to help you with a little more information, such as any /var/log/apache2/*.log
entries.
Best Answer
Maybe is better to enable firewall? UFW can allow access from host/network and deny for the rest of the world.
xxx.xxx.xxx.xxx
- represent your local network,zz
reprezent network maskYou can list rules with command
sudo ufw status
or
sudo ufw status numbered