PhilCorleone Posted September 27, 2015 Share Posted September 27, 2015 (edited) Welcome to the PrestaShop Forum, In this tutorial, we will be taking a fresh installed Ubuntu VPS or dedicated server and transform it to a webserver that will be ready to host Prestashop. The benefit of running a manually installed and configured LEMP stack is the avoidance of control panels such as cPanels and such. In addition, the RAM memory of your server would be less consumed. At the end, you are saving money and resources. Please note that at the time of this article, the versions of software were the following: Ubuntu 14.04 Prestashop 1.6.0.14 This does not mean that this lesson will not work with other versions, but keep in mind compatibility issues. Prerequisite: Please have the most common Ubuntu repositories added to your repositories list. Step 1: Login into your freshly installed Ubuntu as root or as the user you created during installation. Step 2: Follow the following instructions carefully. Please be advised that the instructions are chronological in order. The parts in red are what needs to be changed by you. # Update Serversudo apt-get update && time sudo apt-get dist-upgradesudo apt-get install unzip--------------------------------------# nginx installation & upgradesudo apt-get install nginxsudo service nginx stopsudo aptitude install python-software-propertiessudo add-apt-repository ppa:nginx/stablesudo aptitude updatesudo aptitude safe-upgradesudo apt-get upgrade nginxsudo service nginx restartnginx -v--------------------------------------# MySQL Installationsudo apt-get install mysql-serversudo mysql_install_dbsudo mysql_secure_installation // follow instructions and delete any temporary databases then say yes to reflush privileges--------------------------------------# PHP installationsudo apt-get install php5-fpm php5-mysql php5-curl php5-cli php5-mcrypt// upgrade to latest stable version. Choose whatever version suits yousudo apt-add-repository ppa:ondrej/php5-oldstable // to add php 5.4 versions repositorysudo apt-add-repository ppa:ondrej/php5 // to add php 5.5 versions repositorysudo apt-add-repository ppa:ondrej/php5-5.6 // to add php 5.6 versions repository// reinstall php (this will upgrade it to latest version)sudo apt-get install php5 // setup will ask you whether to replace existing php.ini file and keep the current. That's up to you.// edit the php.ini file in case you chose "replace the current"sudo nano /etc/php5/fpm/php.iniCtrl + W = cgi.fix_pathinfo // uncomment and then set to 0Ctrl + W = max_filesize // set it to 50 MBCtrl + W = post_max // set it to 50 MBCtrl + W = memory_limit // set it to 128 MB Ctrl + W = max_input_vars // uncomment and then set it to 10000Ctrl + W = expose_php // set to offsudo service php5-fpm restart--------------------------------------# General & Security Configurationssudo mkdir -p /var/www // to create the folder wwwsudo find * -type d -print0 | xargs -0 chmod 0755 // to set 755 permission for folderssudo find . -type f -print0 | xargs -0 chmod 0644 // to set 644 permission for filessudo nano /var/www/info.php // this will create an empty file, copy and paste the code inside and the hit Ctrl + x to save and exit<?phpphpinfo();?>http://domain.com/info.php // to test if php is runningsudo mkdir -p /var/www/nginx-logs/domain.com // Create logs directorysudo chmod -R 700 /var/www/nginx-logs // restrict permission to root onlysudo rm /etc/nginx/sites-available/default // remove the default host filesudo rm /etc/nginx/sites-enabled/default // remove the default host filesudo nano /etc/nginx/sites-available/domain.com // Create PrestaShop host file and paste configuration. WARNING: nginx configuration file codes are at the end of the articlesudo ln -s /etc/nginx/sites-available/domain.com /etc/nginx/sites-enabled/domain.com// remove nginx version from http headerscd /etc/nginx/nginx.confserver_tokens off; // uncomment this line by removing the #// while still in nginx.conf file, uncomment all of these to enable gzipgzip on; gzip_disable "msie6"; gzip_vary on; gzip_prox ied any; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;sudo chown www-data:www-data -R /var/www/ #apply this command to give nginx user www-data the freedom to write and read in the www folder. Important!!! sudo service nginx restart // to restart nginx service and load new configurations// Change default port of ssh to that of Windows RDP for spoofing, remember to reconnect to port 3389 or whatever you set next timecd /etc/ssh/sshd_configCtrl + W = port 22 // set it to 3389 or whatever you likesudo service ssh restart--------------------------------------# PHPMyAdminsudo apt-get updatesudo apt-get install phpmyadmin // in configuration, when it asks for httpd or apache, hit TAB in the keyboard to choose neither then Entercd /usr/share // browse the directory where phpmyadmin is atls -l // list all file in directory to make sure phpmyadmin existsudo mv phpmyadmin sqlinterface // renaming the folderls -l // list all files again to make sure renaming was successfulsudo ln -s /usr/share/sqlinterface /var/www // Create a symbolic link to your root foldersudo php5enmod mcrypt // phpmyadmin relies on mycrypt addonsudo service php5-fpm restarthttp://domain.com/sqlinterface // browse to test--------------------------------------# RemotingDownload WinSCP for windows.Connect using SCP protocol by typing the IP address of your server and the port you specified earlier.The SCP protocol is much better and faster than FTP.Never install or setup FTP.--------------------------------------# Install linux dashcd /var/wwwsudo apt-get install gitsudo git clone https://github.com/afaqurk/linux-dash.git// don't forget to rename the folder to whatever name you like and match it up with that in nginx host file# Securing# Install Apache Utils to create a username and password for linux dashsudo apt-get install apache2-utils# Create a user and passcd /etc/nginx/sudo htpasswd -b -c htpasswd Username Password--------------------------------------Congratulation! You are now ready to install Prestashop. Step 3: Attached, are the host file. Copy the lines inside of them and paste into the host file you created above in "# General & Security Configurations". The following configuration supports http only. If you want to enable https, uncomment the ssl lines and tweak them up properly. For non-www to www redirection: Look for attachments. For www to non-www redirection: Look for attachments. That's all for today! Please remember to give back to the community. This lesson took weeks to become what it is right now. Any suggestions and ideas in the scope of this article are welcome. For moderators, you are welcome to fix, add and reformat any part of this article. - Phil Host files.zip Edited September 28, 2015 by PhilCorleone (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now