RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
Category: AWS SERVER
How to Install Apache on CentOS 7
1) First, clean-up yum: sudo yum clean all
2) As a matter of best practice we’ll update our packages: sudo yum -y update
3) Installing Apache is as simple as running just one command: sudo yum -y install httpd
4) And then start Apache: sudo systemctl start httpd
5) Be sure that Apache starts at boot: sudo systemctl enable httpd
6) To check the status of Apache: sudo systemctl status httpd
7) To stop Apache: sudo systemctl stop httpd
Create, import and export mysql database using terminal
1) To Export a database, open up terminal, making sure that you are not logged into MySQL and type
mysqldump -u [username] -p [database name] > [database name].sql
mysqldump -u root -p admin_ghc > admin_ghc.sql
2) To import a database, first create a new blank database in the MySQL shell to serve as a destination for your data.
CREATE DATABASE newdatabase;
mysql -u [username] -p newdatabase < [database name].sql
3) stop the MySQL process
/etc/init.d/mysql stop
Login with PEM file from Terminal
1) Download PEM file and then give permission 0400
sudo chmod -R 0400 name.pem
2) Then login with PEM file
ssh -i name.pem ubuntu@ip_address
Set up AWS Server in ubuntu 16.04 LTS
1) sudo apt-get update
2) sudo apt-get upgrade
3) sudo vi /etc/environment
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
4) sudo reboot
5) sudo apt-get install mysql-server mysql-client
6) sudo apt-get install apache2 apache2-dev
7) sudo apt-get install php libapache2-mod-php libapache2-mod-wsgi libmysqlclient-dev php-zip zip php-mcrypt php-mbstring php-curl curl build-essential
8) sudo /etc/init.d/apache2 restart
9) sudo apt-get install sendmail
10) sudo apt-get install phpmyadmin
11) sudo vim /etc/apache2/apache2.conf
# phpMyAdmin Configuration
Include /etc/phpmyadmin/apache.conf
12) sudo /etc/init.d/apache2 restart
13) sudo apt-get install vsftpd
14) sudo vim /etc/vsftpd.conf
uncomment write_enable=YES
uncomment chroot_local_user=YES
Add at last in file
user_sub_token=$USER
local_root=/var/www/html/
allow_writeable_chroot=YES
15) sudo adduser username
16) sudo chown username: username /var/www/html
17) sudo chmod a-w /var/www/html/
18) sudo chmod -R 0777 /var/www/html
19) sudo service vsftpd restart
20) sudo a2enmod rewrite
21) sudo service apache2 restart
22) sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
sql_mode = ''
23) sudo vi /etc/php/7.0/apache2/php.ini
change upload_max_filesize = 2M -> upload_max_filesize = 50M
24) sudo service apache2 restart