Skip to content

Instantly share code, notes, and snippets.

@bulentsakarya
Created October 25, 2018 09:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bulentsakarya/228d1dd552fdb704af1ec01879113e98 to your computer and use it in GitHub Desktop.
Save bulentsakarya/228d1dd552fdb704af1ec01879113e98 to your computer and use it in GitHub Desktop.
Ubuntu + Apache + MySQL + Php + Let's Encrypt + Mod Pagespeed + WordPress
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
adduser sakarya
usermod -aG sudo sakarya
ufw app list
ufw allow OpenSSH
ufw enable
ufw status
sudo apt install apache2
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
sudo ufw app list
sudo ufw allow 'Apache Full'
sudo ufw status
sudo systemctl status apache2
/* Domain Ekleme */
sudo mkdir -p /var/www/domainadim.com/html
sudo chown -R $USER:$USER /var/www/domainadim.com/html
sudo chmod -R 755 /var/www/domainadim.com
sudo nano /etc/apache2/sites-available/domainadim.com.conf
<VirtualHost *:80>
ServerAdmin admin@domainadim.com
ServerName domainadim.com
ServerAlias www.domainadim.com
DocumentRoot /var/www/domainadim.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite domainadim.com.conf
/* Domain Ekleme Sonu */
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo systemctl restart apache2
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod http2
sudo a2enmod session
sudo apache2ctl configtest
sudo systemctl restart apache2
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
sudo dpkg -i mod-pagespeed-*.deb
sudo systemctl restart apache2
sudo apt-get -f install
sudo apt-get install webp
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl status apache2
reboot
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-apache
sudo apache2ctl configtest
sudo systemctl reload apache2
sudo certbot --apache -d domainadim.com -d www.domainadim.com /* Diğer domainlerde yanına aynı şekilde eklenecek */
sudo certbot renew --dry-run
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl status apache2
sudo apt install mysql-server
sudo mysql_secure_installation
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Y6kA856xqlJ4lIQzzhEWNl';
CREATE DATABASE wj3hQ1YL1PvLbFng2538Jz DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON wj3hQ1YL1PvLbFng2538Jz.* TO 'px0Ce6420ecu3Waj8l26HF'@'localhost' IDENTIFIED BY 'x3T303SDT3JL6gOLYV1xDu';
FLUSH PRIVILEGES;
EXIT;
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
DirectoryIndex index.php
sudo apt install php-cli php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl status apache2
reboot
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
sudo nano /etc/apache2/conf-available/security.conf
ServerTokens Prod
ServerSignature Off
Header set X-Content-Type-Options: "nosniff"
Header set X-Frame-Options: "sameorigin"
Header set X-XSS-Protection "1; mode=block"
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl status apache2
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
touch /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
mkdir /tmp/wordpress/wp-content/upgrade
sudo cp -a /tmp/wordpress/. /var/www/domainadim.com/html
sudo chown -R www-data:www-data /var/www/domainadim.com/html
sudo find /var/www/domainadim.com/html/ -type d -exec chmod 750 {} \;
sudo find /var/www/domainadim.com/html/ -type f -exec chmod 640 {} \;
sudo nano /etc/apache2/sites-available/domainadim.com-le-ssl.conf
<VirtualHost *:443>
..
..
..
<Directory /var/www/domainadim.com/html/>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl status apache2
reboot
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
wp-config.php
define('FORCE_SSL_ADMIN', true);
define('AUTOMATIC_UPDATER_DISABLED', true );
define('WP_AUTO_UPDATE_CORE', true);
define('WP_TEMP_DIR','/var/www/domainadim.com/html/wp-content/uploads/');
define('FS_METHOD', 'direct');
define('DISABLE_WP_CRON', true);
define('ENABLE_CACHE', TRUE);
define('CACHE_EXPIRATION_TIME', 900);
define('WP_POST_REVISIONS', 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment