I have spend a lot of times configuring CS-Cart to work with NGINX server , bottom line is to cache static content and have speed at the same time. This is my step by step tutorial to install NGINX server and run CS-Cart so here it is :----- In my environment I am using Ubuntu Precise Edition - which you can grab from Ubuntu website its 12.04 edition, obviously run the following steps once you are done with your UBUNTU installation.
NGINX Installation procedure:
Open Terminal. Open the Sources file for aptitude using vi. If you are not familiar with vi, open the file in nano or gedit.
sudo gedit /etc/apt/sources.list
If you are looking for ways to upgrade or install NGINX in Ubuntu or Debian systems, you are in right place. You can install them easily using the aptitude or apt-get command.The process only takes couple of minutes and requires minimal Linux knowledge.
NGINX Installation procedure:
Open Terminal. Open the Sources file for aptitude using vi. If you are not familiar with vi, open the file in nano or gedit.
sudo gedit /etc/apt/sources.list
If you are using Debian Squeeze (version 6.x),
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx
If you are using Ubuntu, select the respective lines from below,
For Ubuntu Lucid (Version 10.04),
deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx
For Ubuntu Oneiric (Version 11.10),
deb http://nginx.org/packages/ubuntu/ oneiric nginx
deb-src http://nginx.org/packages/ubuntu/ oneiric nginx
For Ubuntu Precise (Version 12.04),
deb http://nginx.org/packages/ubuntu/ precise nginx
deb-src http://nginx.org/packages/ubuntu/ precise nginx
Add the lines applicable to you in the sources.list file. Now save and close the file. In order to authenticate the repository and to avoid warnings about missing gpg key during installation of the nginx package, it is advised to add the key used to sign the nginx packages and repository to the apt program keyring. Run the following commands in the terminal,
Shell2 lines |
Once added, update the aptitude with new repository,
Shell1 line |
Now to install NGINX in Ubuntu or Debian systems, run the following command in terminal,
Shell1 line |
Once NGINX is installed now - will install database and php and configure them properly - In my installation I decided to go with Percona its faster and for what I need I prefer to go with that so here is the next step But wait here before you install Percona we need to get the repo in Ubuntu
wget https://repo.percona.com/apt/percona-release_0.1-3.$(lsb_release -sc)_all.deb
dpkg -i percona-release_0.1-3.$(lsb_release -sc)_all.deb
Remember to update the local cache:
$ apt-get update
After that you can install the server and client packages
apt-get install percona-server-server-5.6 percona-server-client-5.6 -y
During installation it will ask you to set your mysql ROOT password so please go head and setup your password but DONT FORGET THAT Once above is installed now we need to install the major chunk
apt-get install memcached php5-cli php5-fpm php5-mysql php5-curl php5-gd php5-imagick php5-mcrypt php5-memcached
Once above step is completed - I will prefer if you can reboot your server so everything is normal and not acting UP :), once your server is up we need to make sure NGINX is stop and not working, please run the following command.
$ service nginx stop
NGINX CONFIGURATION FOR CS-CART Starts HERE remove all contents from nginx.conf file located at /etc/nginx/nginx.conf
After that goto your cd /etc/nginx/conf.d/httpd.conf
Please remember to change YOURDOMAIN with your domain name - Last thing you need to do if you have SSL enable shopping cart you need to add the following cert to your /etc/nginx/certs folder if that folder is not created then please create one and upload your .key and .crt for your SSL.
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
test your configuration by using the following command
nginx -t
if everything is good with no error - now simply run service nginx restart upload your files to /var/www/YOURDOMAIN/public_html change your database settings in config.local.php in cs-cart folder once thats done now its time to create MYSQL DB
root@localhost:~# mysql -u root -p
mysql> CREATE DATABASE cs-cart;
GRANT ALL PRIVILEGES ON cs-cart.* TO root@localhost IDENTIFIED BY 'YOURPASS';
If you dont already have your cs-cart Database file you can run the installation.
The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.
-
Upload the SQL file to the server.Type this this command:
-
PLAINTEXT1 line
mysql -p -u username database_name < file.sqlTo Export MYSQL DB
mysqldump -p -u username database_name > dbname.sql
Was this worth your time?
