Toggle navigation

LAMP/LNMP Stack Image Guide

Version 1.0.0

This is the user guide of  the software image powered by Websoft9, The Image Including LNMP Stack,LAMP Stack, etc.

For more technical support, please go to

After loading the image,To access, using following URL

http://< Public net IP >

Image Feature:

1. Source compiler installation, download the latest and most stable version from the official, security optimization

2. Providing multiple PHP versions (php-7, php-5.6, php-5.5, php-5.4, php-5.3)

3. jemalloc optimize MySQL

4. Providing add a virtual host script, include Let’s Encrypt SSL certificate

5. Add ftp acount to nginx via the shell script menu

6. Provide MySQL,PHP, Redis, Memcached,phpMyAdmin upgrade script

7. Provide local backup and remote backup (rsync between servers) 、 Alibaba cloud OSS backup(Intranet) script

Application version

LNMP 7.0.15/7.0.16:Nginx1.10.3,PHP7.0.15/7.0.16,MySQL5.6.35,Redis3.2.6,Memcached1.4.34,Jemalloc4.4.0,Pure-FTPd1.0.43,phpMyAdmin4.4.15.9

LAMP 7.0.15/7.0.16:Apache2.4.23,PHP7.0.15/7.0.16,MySQL5.6.35,Redis3.2.6,Memcached1.4.34,Jemalloc4.4.0,Pure-FTPd1.0.43,phpMyAdmin4.4.15.9

LAMP 5.6.30:Apache2.4.23,PHP5.6.30,MySQL5.6.35,Redis3.2.6,Memcached1.4.34,Jemalloc4.4.0,Pure-FTPd1.0.43,phpMyAdmin4.4.15.10

Application Directories

Nginx install directory: /usr/local/nginx
Apache install directory: /usr/local/apache

Database install directory: /usr/local/mysql or /usr/local/mariadb
Database data directory: /data/mysql or /data/mariadb
Database Configuration File: /etc/my.cnf

PHP install directory: /usr/local/php
PHP Configuration Path: /usr/local/php/etc
PHP Configuration File: /usr/local/php/etc/php.ini
PHP Additional .ini File: /usr/local/php/etc/php.d

Memcached install directory: /usr/local/memcached
Memcached Configuration File: /etc/init.d/memcached

Redis install directory: /usr/local/redis
Redis Configuration File: /usr/local/redis/etc/redis.conf

Web Context document root: /data/wwwroot/default
phpMyAdmin install directory: /data/wwwroot/default/phpMyAdmin
Web logs directory: /data/wwwlogs

The default ip direct access to the contents of the corresponding root directory:/data/wwwroot/default ,This directory contains the home pagedemo,Opcache Control Panel,phpinfo,phpmyadmin,Probes and other documents,Directory inside the file can be deleted, the directory can not be deleted.

How to manage service

Nginx: service nginx {start|stop|status|restart|reload|configtest}
MySQL: service mysqld {start|stop|restart|reload|status}
PHP: service php-fpm {start|stop|restart|reload|status}    
Pure-Ftpd: service pureftpd {start|stop|restart|status}
Redis: service redis-server {start|stop|status|restart|reload}
Memcached: service memcached {start|stop|status|restart|reload}
Apache: service httpd {start|stop|status|restart|reload}

Default database password

Get database password command:

cd /root/oneinstack
grep dbrootpwd options.conf


default user/password:root/123456


How to manage MySQL

How to manage MySQL: click here.

How to add a virtual host

cd   /root/oneinstack             
./                                #NOTE: If no SSL certificate is purchased,SSL under Nginx please
How to delete a virtual host

cd   /root/oneinstack         
./ del 

  1. Create the database required for the site
  2. Add a virtual host
  3. Create an FTP account           #Remote upload file recommended to install graphical tools:WinSCP
  4. Deploy the code to the site root directory            #NOTE:Ftp upload code do not need to modify permissions,default is already www; Download the code in server , you must modify the site root and subdirectories,Directory file permissions are www; If there is a problem with site permissions


Web site root permissions to follow:
file 644, folder 755 ,Permissions Users and groups www
If there is a file permissions problem, execute the following three commands:

chown -R www.www /data/wwwroot/
find /data/wwwroot/ -type d -exec chmod 755 {} \;
find /data/wwwroot/ -type f -exec chmod 644 {} \;

cd /root/oneinstack #Must enter the directory execution under oneinstack
./ #Do not sh such execution

cd /root/oneinstack

Some items can be uninstalled separately, such as RDS database, the database can be uninstalled separately

cd /root/oneinstack
# NOTE: Please backup your data

cd /root/oneinstack
                #Do not sh such execution

By default, 22 is enabled (ssh)80,443(Nginx) 21,20000:30000(FTP)

Other ports are rejected,If you need to allow other ports, please operate(open 8080 port), command:

iptables -I INPUT 4 -p tcp -m state –state NEW -m tcp –dport 8080  -j ACCEPT
service iptables save

cd /root/oneinstack
                              #NOTE: Support install and uninstall function

by default,in order to reduce PHP compile time,improve performance(Opcache is recommended for production environments),The PHP environment loads the Opcache module by default(PHP5.5,5.6,7.0),But this will appear PHP code updates, take 2 to 3 minutes to take effect,This affects the efficiency of the site during the commissioning phase suggest that you close or refresh the cache every time there is a code update(Recommended method two)

Method 1:Uninstall Opcache

cd /root/oneinstack


Method 2: Refresh the PHP cache

Access http://< Public net IP >/ocp.php
Or direct access http://< Public net IP >/ocp.php/ocp.php?RESET=1

Note:If you purchased a data disk(And only one data disk),It is recommended to mount the data disk first,the site content, database storage data cloud disk,If there is no purchase data cloud disk Ignore the tutorial!

cd /root/oneinstack                  #Must enter the directory execution under oneinstack
./               #mount data disk and migrate

Because this image was build based on 1 Core 1G ECS,the configuration and parameters for MySQL/MariaDB,PHP are original without any change, highly recommended If this is not the case, run the following optimization script:

cd /root/oneinstack
                      #Do not sh or bash such execution

1. It may take 1 minute, do not interrupt
2. This script will automatically optimize MySQL, PHP and other parameters according to the system configuration

cd /root/oneinstack               

Perform the backup immediately:
cd /root/oneinstack     

Set Scheduled Task Automatic Scheduled Backup:
Example:Can be added to scheduled tasks, such as automatic backups every day 1:00
# echo ‘0 1 * * * cd ~/oneinstack;./ > /dev/null 2>&1 & ‘ >> /var/spool/cron/root

View the backup:
View the local backup:
ls -l /data/backup/