OpenCart is a set of excellent, free and open source e-commerce solutions. In fact, it is simply an online store program. The discussion on the advantages and disadvantages of OpenCart, Prestashop, Zen Cart, etc. is not included in this article. Recently, I'm working on this OpenCart. I'll simply share with you some information about the LNMP built under VPS (for the installation of LNMP, see here )How to install and configure OpenCart in the environment. Of course, I'm just learning, old bird~
Install and configure OpenCart under LNMP [Tutorial]
- Add virtual host under LNMP
- Install OpenCart
- Nginx pseudo static setting of OpenCart
1、 Add virtual host under LNMP
1. For example, add, the command is as follows,
/root/vhost.sh
This article has been updated, and this step is no longer required. Note: Please select [y] to add rewrite rule options and set it as opencart (Nginx will create a file named opencart.conf, which we will use later to write specific pseudo static)
2. Switch to your virtual host directory (assuming your directory is/home/wwwroot/abc.com)
cd /home/wwwroot/abc.com
2、 Install OpenCart
1. Download OpenCart (please check the latest version on the official OpenCart website)
wget http://opencart.googlecode.com/files/opencart_v1.5.1.3.1.zip
2. Unzip OpenCart (Note: If unzip is invalid, please install the zip program)
unzip opencart_ v1.5.1.3.1.zip
3. Move the upload folder to the root directory of the virtual host
mv upload/* ./
4. Modify file permissions
chown -R www /home/wwwroot/abc.com
chmod 0755 image/
chmod 0755 image/cache/
chmod 0755 cache/
chmod 0755 download/
chmod 0755 config.php
chmod 0755 admin/config.php
5. The browser accesses your domain name abc.com to install the graphical interface
Note: If the file permission error is still prompted, please refer to step 2 (3) to continue modifying in SSH
6. The database creation and graphical interface installation under PHPMyAdmin will not be explained. It should not be a problem
7. For security reasons, delete the install folder (Update 2011-12-4!)
rm -rf install
3、 Nginx pseudo static setting of OpenCart
Update on May 25, 2012: The previous pseudo static rules were wrong, which could lead to various problems. Many blog websites copied and reproduced them directly, and Weimo strongly condemned them! Again, we would like to state that WeChat Magic welcomes reprinting, but please keep the original link to stimulate the enthusiasm for originality!
Before execution, please select Enable Use SEO URL's under OpenCart background System ->Settings ->Server. This is mainly to hope that OpenCart can implement pseudo static like WP, which is more conducive to SEO
1. Open the conf file
Vi/usr/local/nginx/conf/vhost/domain.conf
2. Click [Insert] in location~. * . (php | php5)$ Add the following content before the field (abc.com please change to your own domain name)
location / { if ($host != 'www.abc.com') { rewrite ^/(.*)$ http://www.abc.com/ $1 permanent; } try_ files $uri @opencart; } location @opencart { rewrite ^/(.+)$ /index.php?_ route_=$ 1 last; } location /admin/ { index index.php; } location ~* (\.(tpl|ini))$ { deny all; }
3.【ESC】->:wq! Save and Exit
At present, there are so many operations for me. If you have any problems, you are welcome to put forward, and I hope you can also recommend some good website building programs to Weimo. For details, please see QQ Contact Me on the right!