هک‌ها و تشعشعات وجدان آزاد

نوشته‌های سیدمحمدمسعود صدرنژاد

ابزار کاربر

ابزار سایت


ec2_lamp

Create Swap Space

If your mysql crashes because of lack of memory use above commands to create 1 GB swap:

Run dd if=/dev/zero of=/swapfile bs=1M count=1024
Run mkswap /swapfile
Run swapon /swapfile
Add this line /swapfile swap swap defaults 0 0 to /etc/fstab  

Step 4 is needed if you would like to automatically enable swap file after each reboot.

Installation

sudo su
apt-get update
apt-get upgrade
reboot
sudo mysql_install_db
sudo mysql_secure_installation
sudo apt-get install apache2 mysql-server php5-mysql php5 libapache2-mod-php5 php5-mcrypt git
git clone https://github.com/smmsadrnezh/sadrnezhaad.ir

VirtulHost Configuration

mv  /var/www/html/ /var/www/PUBLIC_IP_ADDR
touch /var/www/PUBLIC_IP_ADDR/index.html
mkdir  /var/www/DOMAIN_NAME
nano /etc/apache2/sites-available/000-default.conf
sudo a2enmod expires
service apache2 restart

new virtualhost config:

<VirtualHost *:80>
      ServerAdmin [email protected]
      DocumentRoot /home/www/customername/customername.com/
      ServerName customername.com
      Serveralias www.customername.com

  ExpiresActive On
      ExpiresByType text/html "access plus 0 seconds"
      ExpiresByType image/gif "access plus 1 years"
      ExpiresByType image/jpg "access plus 1 years"
      ExpiresByType image/jpeg "access plus 1 years"
      ExpiresByType image/png "access plus 1 years"
      ExpiresByType image/vnd.microsoft.icon "access plus 1 years"
      ExpiresByType image/x-icon "access plus 1 years"
      ExpiresByType image/ico "access plus 1 years"
      ExpiresByType application/javascript "now plus 1 months"
      ExpiresByType application/x-javascript "now plus 1 months"
      ExpiresByType text/javascript "now plus 1 months"
      ExpiresByType text/css "now plus 1 months"
      ExpiresDefault "access plus 1 days"

      <Directory /home/www/customername>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Order allow,deny
              allow from all
      </Directory>
</VirtualHost>

Hide Apache and PHP signature

nano /etc/apache2/apache2.conf

add the following lines:

ServerTokens Prod
ServerSignature off
nano /etc/php5/apache2/php.ini

change to the following line:

expose_php = Off

DB Restore

ec2_lamp.txt · آخرین ویرایش: 2016/03/11 17:38 توسط smmsadrnezh