Skip to content

Instantly share code, notes, and snippets.

@jacksonfdam
Last active June 30, 2023 02:59
Show Gist options
  • Save jacksonfdam/2cda889b707b02b07873ce0ce461e95d to your computer and use it in GitHub Desktop.
Save jacksonfdam/2cda889b707b02b07873ce0ce461e95d to your computer and use it in GitHub Desktop.
# phpstorm, webstorm
.idea/
/.vscode
/nbproject
/node_modules
# sublime and other ide
.project
*.sublime-project
*.sublime-workspace
.brackets.json
_notes
# logs
logs/
*.log
npm-debug.log*
error_log
# OS generated files
[Tt]humbs.db
ehthumbs.db
*~
.*~
._*
*.bak
# Recycle bin folder used by different os
.Trash-*
$RECYCLE.BIN/
# Windows shortcuts
*.lnk
# Folder config file
[Dd]esktop.ini
*.DS_store
.DS_store?
# node packages
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules/
# Bower packages
bower_components/
# svn folders
.svn/
# composer
vendor/
composer.phar
composer.phar
composer.lock
# Security tokens
*.pem
*.pub
*.crt
.env
# ignore all files starting with .
.*
# track this file .gitignore (i.e. do NOT ignore it)
!.htaccess
# track this file .gitignore (i.e. do NOT ignore it)
!.gitignore
# track .editorconfig file (i.e. do NOT ignore it)
!.editorconfig
# track readme.md in the root (i.e. do NOT ignore it)
!readme.md
# ignore all files that start with ~
~*
# ignore OS generated files
ehthumbs.db
Thumbs.db
# ignore Editor files
*.sublime-project
*.sublime-workspace
*.komodoproject
# ignore log files and databases
*.log
*.sql
*.sqlite
# ignore compiled files
*.com
*.class
*.dll
*.exe
*.o
*.so
# ignore packaged files
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php
wp-content/plugins/hello.php
/license.txt
/readme.html
/sitemap.xml
/sitemap.xml.gz
# ignore everything in the "wp-content" directory, except:
# "mu-plugins" directory
# "plugins" directory
# "themes" directory
wp-content/*
!wp-content/plugins/
!wp-content/themes/
# ignore these plugins
wp-content/plugins/hello.php
# ignore specific themes
wp-content/themes/twenty*/
# ignore node/grunt dependency directories
node_modules/
Options All -Indexes
Header unset Pragma
FileETag None
Header unset ETag
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<FilesMatch "^.*(error_log|wp-config\.php|php.ini|\.[hH][tT][aApP].*)$">
Order deny,allow
Deny from all
</FilesMatch>
# prevent access to some files
<FilesMatch "^(wp-config.php|readme.html|license.txt|README.md|.gitignore|.gitattributes|.htaccess|error_log)">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
#Change Charset and Language headers
AddDefaultCharset UTF-8
DefaultLanguage en-US
#Set default time zone
SetEnv IN America/Sao_Paulo
# Disable directory browsing
Options All -Indexes
<Directory "/var/www/wp-content/uploads/">
<Files "*.php">
Order Deny,Allow
Deny from All
</Files>
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault A0
# 1 YEAR - doesn't change often
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A31536000
</FilesMatch>
# 1 WEEK - possible to be changed, unlikely
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
ExpiresDefault A604800
</FilesMatch>
# 3 HOUR - core content, changes quickly
<FilesMatch "\.(txt|xml|js|css)$">
ExpiresDefault A10800
</FilesMatch>
</IfModule>
# Explicitly disable caching for scripts and other dynamic files
<FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
# Java script compression
<FilesMatch "\.js$">
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*)\.js$ $1\.js.gz [L]
ForceType text/javascript
</FilesMatch>
# Java script - vary accept encoding
<FilesMatch "\.js\.gz$">
ForceType text/javascript
Header set Content-Encoding gzip
Header set Vary Accept-Encoding
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
</IfModule>
# Custom error pages
ErrorDocument 400 /error404.php
ErrorDocument 401 /error401.php
ErrorDocument 403 /error403.php
ErrorDocument 404 /error404.php
ErrorDocument 500 /error500.php
# Sisable the server signature
ServerSignature Off
# Max upload size
php_value upload_max_filesize 5M
# Enable compression on localhost
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
</IfModule>
# Fix bad x-ua meta tag
<FilesMatch "\.(htm|html|php)$">
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</FilesMatch>
# Serve font files
<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
#Enable gzip with mod_gzip
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
# Secure directory by disabling script execution
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
# mime type for web fonts
<IfModule mod_mime.c>
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff woff2
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
</IfModule>
DB_NAME=wordpress
DB_USER=homestead
DB_PASSWORD=secret
DB_HOST=localhost
DB_PREFIX=wp_
WP_SITEURL=http://localhost
WP_HOME=http://localhost
WP_DEBUG=TRUE
<?php
/**
* Custom WordPress configurations on "wp-config.php" file.
*
* This file has the following configurations: MySQL settings, Table Prefix, Secret Keys, WordPress Language, ABSPATH and more.
* For more information visit {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php} Codex page.
* Created using {@link http://generatewp.com/wp-config/ wp-config.php File Generator} on GenerateWP.com.
*
* @package WordPress
* @generator GenerateWP.com
*/
require_once(__DIR__ . '/vendor/autoload.php');
(new \Dotenv\Dotenv(__DIR__.'/'))->load();
/* MySQL settings */
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASSWORD', getenv('DB_PASSWORD'));
define('DB_HOST', getenv('DB_HOST'));
define( 'DB_CHARSET', 'utf8mb4' );
/* MySQL database table prefix. */
$table_prefix = getenv('DB_PREFIX');
/* Authentication Unique Keys and Salts. */
define('AUTH_KEY', 'T+w[,t6TK=A).!_*M#v,+w9T%OTthcto S+YV^6Y=A4~}!9t|1+@)w$mnr;UUSRq#6qFQ+mW');
define('LOGGED_IN_KEY', 'Wp$6L/!1-7 u$G &+B7pCYi(EQS4(p-)b;l[kNM$Ws#sbF6KGu|Z3vpSkCdkHwu-HaRn7Y=A+Rz>G');
define('AUTH_SALT', '#4P7LbWVHG4bJ.UNL 39RtRzV KZpocNTj1ljq)x~raeB-tN=Fxcc*E{b,}*HYWb');
define('SECURE_AUTH_SALT', 'R>NCg0,427psavP93A*Cb9[=3,^`#j=kv[VMEt~25K^HZ?*.*)79CnW;o%3|PE@y');
define('LOGGED_IN_SALT', 'XuE+%[~yf`HO1PHZL(%Si*C#+)Zy->mu0~(zwW^S;>r)@*SxWn^p]5AiAckO-cF,');
define('NONCE_SALT', 'y(*ATS/S:r+[]>f-fD!$9Q+.D!HX=(],^^hpE*WLk^Wl^[F`zxdoxaJS.,=F}WZv');
/* Custom WordPress URL. */
define( 'WP_SITEURL', getenv('WP_SITEURL') );
define( 'WP_HOME', getenv('WP_HOME') );
/* Disable Post Revisions. */
define( 'WP_POST_REVISIONS', false );
/* Media Trash. */
define( 'MEDIA_TRASH', false );
/* Multisite. */
define( 'WP_ALLOW_MULTISITE', false );
/* WordPress debug mode for developers. */
define( 'WP_DEBUG', getenv('WP_DEBUG') );
define( 'WP_DEBUG_LOG', getenv('WP_DEBUG') );
define( 'WP_DEBUG_DISPLAY', true );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
/* PHP Memory */
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
/* WordPress Cache */
define( 'WP_CACHE', false );
/* Compression */
define( 'COMPRESS_CSS', true );
define( 'COMPRESS_SCRIPTS', true );
define( 'CONCATENATE_SCRIPTS', true );
define( 'ENFORCE_GZIP', true );
/* Updates */
if(WP_DEBUG){
define( 'WP_AUTO_UPDATE_CORE', true );
define( 'DISALLOW_FILE_MODS', false );
define( 'DISALLOW_FILE_EDIT', false );
}else{
define( 'WP_AUTO_UPDATE_CORE', true );
define( 'DISALLOW_FILE_MODS', true );
define( 'DISALLOW_FILE_EDIT', true );
}
/* Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/* Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
#!/bin/bash -e
clear
echo "============================================"
echo "A robot is now installing WordPress for you."
echo "============================================"
#download wordpress
curl -O https://wordpress.org/latest.tar.gz
#unzip wordpress
tar -zxvf latest.tar.gz
#change dir to wordpress
cd wordpress
#copy file to parent dir
cp -rf . ..
#move back to parent dir
cd ..
#remove files from wordpress folder
rm -R wordpress
#create wp config
curl -o .env https://gist.githubusercontent.com/jacksonfdam/2cda889b707b02b07873ce0ce461e95d/raw/0b37b5749dd282b71bad92a1d493ce0fbfeb84a6/env
curl -o wp-config.php https://gist.githubusercontent.com/jacksonfdam/2cda889b707b02b07873ce0ce461e95d/raw/0b37b5749dd282b71bad92a1d493ce0fbfeb84a6/wp-config.php
curl -o .htaccess https://gist.githubusercontent.com/jacksonfdam/2cda889b707b02b07873ce0ce461e95d/raw/49782510673887c9a4fec70f393a324199f53207/.htaccess
curl -o .gitignore https://gist.githubusercontent.com/jacksonfdam/2cda889b707b02b07873ce0ce461e95d/raw/f971fb77521119a926069c236fac2f1d27fccaf1/.gitignore
curl -sS https://getcomposer.org/installer | php
php composer.phar require "vlucas/phpdotenv"
php composer.phar install -vvv
php composer.phar dump-autoload
#create uploads folder and set permissions
mkdir wp-content/uploads
chmod 775 wp-content/uploads
echo "Cleaning..."
#remove zip file
rm latest.tar.gz
rm license.txt
rm readme.html
rm wp-config-sample.php
echo "========================="
echo "Installation is complete."
echo "========================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment