Skip to content

Instantly share code, notes, and snippets.

@trAve3113r
Last active March 13, 2017 19:47
Show Gist options
  • Save trAve3113r/134c90cea272b1a72518201c01b139e0 to your computer and use it in GitHub Desktop.
Save trAve3113r/134c90cea272b1a72518201c01b139e0 to your computer and use it in GitHub Desktop.
useful DevOps commands
# see debain handbook for admins : https://debian-handbook.info/
# django error: That port is already in use
netstat -lpn | grep: <port_number>
kill -9 <process_id>
# View apache2 errors
cat /var/log/apache2/error.log
#OR
cat /var/log/apache2/<my_custom_file_name>.log
systemctl status apache2.service
journalctl -xn -l # -l makes it verbose
# raeving up apache2
sevice apache2 { start | stop | graceful-stop | restart | reload | force-reload | start-htcacheclean | stop-htcacheclean }
# securely give 'www-data' root privileges
# 1: Create a new group
addgroup <group_name>
# 2: Add 'www-data' to the group
adduser www-data <group_name>
# 3: Change group ownership of the target directory
chown -vR : <group_name> /path/to/target/dir/
# 4: Grant write permission to the new dir owner
chmod -vR g+w /path/to/target/dir
# wrap up -- see how apache2 is running
ps aux | grep apache2 | less
# Check the installed apache2 version (debian)
apachectl -V
#OR
apache2 -V
# enable site
a2ensite
# disable site
a2dissite
# enable an apache2 module
a2enmod
# disable an apache2 module
a2dismod
# add this (to 'apache2.conf' or 'httpd.conf') prevent mod_wsgi server timeouts if numpy is installed
# see SO answer: http://stackoverflow.com/questions/40413171/django-webfaction-timeout-when-reading-response-headers-from-daemon-process
WSGIApplicationGroup %{GLOBAL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment