The URL you are providing looks a bit strange with the ":" after "IP". Furthermore, you should setup a virtual host using you own URL (e.g. "myapp.local") and put this in the /etc/hosts file (127.0.0.1 myapp.local
).
Please find the config for an apache virtual host below. place it in /etc/apache2/sites-available/myapp.conf
and activate using sudo a2ensite myapp.conf
.
Please note the ServerName
: this is the URL you should type in the browser.
<VirtualHost *:80>
# This config will serve the built version of the production version of the crisisgame.molema.org website for local use with local parameters
ServerAdmin webmaster@localhost
ServerName myapp.local
DocumentRoot /home/user/app
DirectoryIndex index.html
<Directory /home/user/app/>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.myapp.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.myapp.log combined
</VirtualHost>
Then edit you /etc/hosts
and add:
127.0.0.1 myapp.local
Then restart the Apache2 Service using sudo service apache2 restart
.
If restarting the service yields an error, then follow the procedure below to find the error. This will elevate you to root-privileged new shell, set Apache's environment variables and then ask Apache to run a check (-S parameter)
martin@debian:~$ sudo -i
[Password]:
root@debian:~# cd /etc/apache2
root@debian:~# . ./envvars
root@debian:~# apache2 -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
Notice the way envvars
is executed: dot-space-dot-slash prefixed. This means that if the script envvars
modifies environment variables their values will be available in the current shell (the first .
represents the current shell). See also Bash Reference Manual, chapter 3.7.4.
The first error usually is no problem. If this report shows other errors, go fix them. Possibly lookup the configs for Apache2 here
Go to your browser and type http://myapp.local/media/file.txt
.
Good luck!
Greetings Martin