Quick Install Apache PHP Mysql for Magento on Ubuntu

sudo apt-get update
sudo apt-get install apache2
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-gd


Add index.php in file

sudo nano /etc/apache2/mods-enabled/dir.conf

#enable apache mod_php without editing file
sudo a2enmod php5
sudo a2enmod rewrite

#enable php modules with editing php.ini file
sudo php5enmod mcrypt

sudo service apache2 restart

ming ming !

Configure Enable mod_rewrite .htaccess

sudo nano /etc/apache2/sites-enabled/000-default.conf

Add just before VirtualHost closing tag

 
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
 
 # Recommended: XSS protection
 
  Header set X-XSS-Protection "1; mode=block"
  Header always append X-Frame-Options SAMEORIGIN
 

Restart apache

sudo service apache2 restart
sudo update-rc.d apache2 defaults
sudo update-rc.d apache2 enable

Create mysql password if needed and just put files in /var/www/html

This is not the end you need to set file permission properly
sftp user and apache both need write permission

find out which user running apache, for ubuntu its www-data

ps aux | egrep '(apache|httpd)' 

Set owner permission to work apache and sftp

addgroup webmasters
usermod -a -G webmasters username_for_sftp
chown -R www-data:webmasters /var/www/html

Set File permission 644 directory 755

cd /var/www/html
find ./* -type d -exec chmod 755 {} \;
find ./* -type f -exec chmod 644 {} \;

to use sftp /var/www must be owned my root:www-data in ubuntu

know directory, disk size
du -hs /path/to/directory
df -h

#list groups of user
groups
#list users of a group
getent group
#add user to a group
usermod -a -G username
#easy dev env permission
chmod -R u=rwx,g=rwx,o=r ./public_html
#lock ports easy with ‘ufw’


Posted

in

,

by

Tags: