Skip to content

Instantly share code, notes, and snippets.

@zachbrowne
Last active April 5, 2023 20:37
Show Gist options
  • Save zachbrowne/e569a543253bfc965c0fbce49f85344a to your computer and use it in GitHub Desktop.
Save zachbrowne/e569a543253bfc965c0fbce49f85344a to your computer and use it in GitHub Desktop.
Frequent Commands
# Clean up webserver permissions
alias fix='sudo find /var/www/* -type d -exec sudo chmod 755 {} \; && sudo find /var/www/* -type f -exec sudo chmod 644 {} \; && sudo chown -R www-data:www-data /var/www/*'
# Add User and Add to Sudo
adduser zach
usermod -a -G sudo exampleuser
CREATE DATABASE database;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
hostnamectl set-hostname new-hostname
nano /etc/hosts
hostnamectl
reboot
/** SSL */
define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
<VirtualHost *:80>
ServerAdmin zachbrowne@gmail.com
ServerName hustle.report
ServerAlias www.hustle.report
DocumentRoot /var/www/hustle.report/public
ErrorLog /var/www/hustle.report/logs/error.log
CustomLog /var/www/hustle.report/logs/access.log combined
</VirtualHost>
Add to bottom of apache2.conf to fix hostname error
ServerName 127.0.0.1
mysql -uroot
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment