- where is document Root on AMI Linux EC2 (httpd, not Apache2)
– /var/www/html – this is where the Apache2 webserver is serving files from. - Where is the apache2 location on Ubuntu:
Apache Logs are at: /var/log/apache2/
Apache conf at: /etc/apache2/conf
check which modules are enabled: apache2ctl -M - check time: timedatectl
- Find recursively for ‘workers’ in current dir (.)
find in files: grep -rnw . -e ‘workers’ - To test if something it is running on 8080
$ netstat -antup | grep 8080
tcp 0 0 :::8080 :::* LISTEN 1526/java
6. Files changed to setup the APJ connector:
/etc/apache2/mods-available/jk.conf
/etc/apache2/apache2.conf
/etc/libapache2-mod-jk/workers.properties
/usr/local/tomcat9/conf/server.xml
/etc/apache2/sites-available/000-default.conf
7. Misleading error on AWS(amazon linux); fixed by using sudo prefix
[ec2-user@ip-172-31-1-38 ~]$ systemctl daemon-reload
Failed to execute operation: The name org.freedesktop.PolicyKit1 was not provided by any .service files
8. To add an existing user to an existing group
usermod -a -G examplegroup exampleusername
9. To view groups assigned to a user:
groups exampleusername
10. If you are unable to switch to home directories of service accounts like tomcat or apache, use this command:
sudo su //the prompt should switch to root
exit //to leave switch to root
11. When you point setup your domain registrar to point to a different hosting provider, (say A), the email will also need to be setup on the hosting provider A. Name servers seem to override email configuration. We cannot setup email directly on the domain registrar and handle email at the registrar company.
12. Uninstall Apache2 on Ubuntu
systemctl stop apache2
apt-get remove apache2
You should get a message like so:
The following packages will be REMOVED:apache2 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
If your /var/www/html is not empty it will not be cleaned up or deleted.
apt-get purge apache2
To test:
ls /etc/apache2 returns only two folders : mods-available and mods-enabled (vs. numerous folders )
13. To test if a process is running on 80
$ netstat -antup | grep 80
OR
$lsof -i :80
14. To test if the port can be reached from outside:
nmap -p 80 -T4 -Pn <IP address here>
15. Here is how check if a service is disabled at boot time.
eg: httpd, apache2, nginx
sudo systemctl is-enabled httpd
Here is how you disable it
sudo systemctl disable httpd
You can also strong disable it but may not be such a good idea.sudo systemctl mask httpd
16. Maintaining history of bash commands with timestamp
echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
source ~/.bashrc
To check :history 30
NOTE: it does not look like this will show timestamp retroactively.