how to check the last lines of an access log
how to check the error logs of apache
how to see the status of the apache server
how to setup a local host file
View Content
🔗 Reference
In the terminal type this. This should get you the last 100 lines of the apache access log.
sudo tail -100 /var/log/apache2/access.log
View Content
sudo vim /var/log/apache2/error.log
View Content
references
sudo systemctl status apache2
this is great for setting creating a websites or at least developing it without having to buy a domain ... for now . This is essentially working apache for the most part and then using your personal computer
- create a conf file for apache
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/test.conf
sudo nano /etc/apache2/sites-available/test.conf
// in the test.conf file, add the ServerName test.com and close the file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/jermaine/test
ServerName test.com
<Directory /home/jermaine/test/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
- next enable the site
sudo a2ensite test.conf
sudo service apache2 reload
-
now, go to your personal and run notepad as an administrator
-
once in notepad, open a file to the path
C:\Windows\System32\drivers\etc\hosts
-
now in the hosts file insert your vps ip address and the ServerName
111.111.111.111 test.com
- and that is about it.
reference
- install all of these things
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
sudo service apache2 restart
- update the server
sudo apt-get update
sudo apt-get -y upgrade
- create the conf file like this
sudo nano /etc/apache2/sites-available/node.conf
// inside node.conf file
<VirtualHost *:80>
ServerName node.com
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
- enable the site
sudo a2ensite node.conf
sudo service apache2 reload
sudo a2ensite example.conf
sudo service apache2 reload
sudo a2dissite example.conf
- you can simply copy the default conf file like this
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.conf
sudo nano example.conf
- in the example file make sure you change the document root location and add the server name
<VirtualHost *:80>
DocumentRoot "/www/var/html"
ServerName www.example.com
# Other directives here
</VirtualHost>
- then add enable the site and reload apache
sudo a2ensite example.conf
sudo service apache2 reload