Skip to content

Instantly share code, notes, and snippets.

@dharma017
Last active August 21, 2024 23:49
Show Gist options
  • Save dharma017/3c3478c5c5011100764cccd90167ae9f to your computer and use it in GitHub Desktop.
Save dharma017/3c3478c5c5011100764cccd90167ae9f to your computer and use it in GitHub Desktop.
Wordpress Setup
server {
root /var/www/foobar.com/public_html;
index index.php;
server_name foobar.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/ssl/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/server.key;
}
server {
if ($host = foobar.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80 ipv6only=on;
server_name foobar.com;
return 404;
}
CREATE DATABASE wp_dbname;
CREATE USER 'wordpress_user'@'%' IDENTIFIED WITH mysql_native_password BY 'passwordhere';
GRANT ALL ON wp_dbname.* TO 'wordpress_user'@'%';
exit
wp core download
wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword [email protected]
# Activate Maintenance mode.
$ wp maintenance-mode activate
Enabling Maintenance mode...
Success: Activated Maintenance mode.
# Deactivate Maintenance mode.
$ wp maintenance-mode deactivate
Disabling Maintenance mode...
Success: Deactivated Maintenance mode.
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment