Install PHP, Apache, MySQL on Linux machine
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install mysql-server mysql-client
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo apt-get install php-cli
sudo apt-get install phpmyadmin apache2-utils
TODO : How to create virtual server, install wordpress and other PHP, Laravel
php-common libapache2-mod-php php-xmlrpc libapache2-mod-fastcgi
build-essential php-dev libbz2-dev libmysqlclient-dev libxpm-dev libmcrypt-dev libcurl4-gnutls-dev libxml2-dev libjpeg-dev libpng12-dev
- Create a folder in
home
or undervar/www
or whereever you want. - Goto
/etc/apache2/sites-available/
folder. Copy000-default.conf
and rename it. For example,website.conf
- Open and set website path
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com
DocumentRoot `/var/www/html`
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Enable virtual host
sudo a2ensite example.com.conf
, - Disable virtual host
sudo a2dissite example.com.conf
(If you want). - Try this is moderewrite not working
sudo a2enmod rewrite
- Restart server
sudo service apache2 restart
Tips: Enable mode rewrite
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
- Edit
sudo nano /etc/hosts
127.0.0.1 example.com
- Goto
php.ini
file, then searchphp_openssl
and uncomment it - Goto
httpd.conf
file and checkLoadModule ssl_module modules/mod_ssl.so
enabled or not - Then goto https-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "<PATH>"
# ServerName <SERVER_NAME>
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "<PATH>"
ServerName <SERVER_NAME>
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
Get latest path https://getcomposer.org/download/
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
php /usr/local/bin/composer
sudo chgrp www-data /var/www/* -R
sudo chmod 775 /var/www/* -R // 777 for all permission
sudo chmod g+s /var/www/* -R
sudo chown -R <username>:<username> /var/www/* // optional
net stop http /y
sudo adduser $USER www-data
sudo chown root:root /var/www
sudo chown -R $USER:www-data /var/www/*
sudo chmod -R 755 /var/www