- Print
- PDF
LEMP
- Print
- PDF
Available in Classic
LEMP is an open source software service platform for web applications utilizing Nginx, MySQL, and PHP based on Linux. It is automatically configured on NAVER Cloud Platform's Compute infrastructure service and can be instantly put into service through a configuration process with only a few steps.
The advantages of using LEMP are as follows:
- You can use a stable web service development platform utilizing the infrastructure of NAVER Cloud Platform.
- You can select a server image and specifications to automatically install and use the LEMP stack service.
For more information on the software used in NAVER Cloud Platform's LEMP, see the following websites:
Creating and accessing server
The method for creating and accessing the server is the same as creating a regular server on NAVER Cloud Platform. The following are detailed procedures and reference guides:
Procedure | Description |
---|---|
1. Set ACG |
|
2. Create server |
|
3. Set public IP |
|
4. Set port forwarding |
|
5. Get admin password |
|
6. Access server |
|
- After you access and log in to the server, change the password of the root account to one you can remember. Enter the
passwd root
command to set a new password. - If you can't connect to the server even if there is no problem in the public IP address and ACG, your LEMP process might be stopped. Run the restart command (
systemctl start httpd
) on the terminal program to restart the process.
Check LEMP installation
When the server is created, the LEMP components are automatically installed, so you can use the service immediately.
Check if the components are installed successfully through the following methods:
Access web
Access the LEMP service through the web, and then check if it is installed successfully.
The access URL is http://{public ip address}
. If the index page of NAVER Cloud Platform's LEMP is run upon accessing, it is successfully installed.
LEMP is set based on HTTP protocol by default. To use a more stable and security-enhanced method, use HTTPS protocol. You can use it after you create SSL certificates and web service domains.
Check installation directory
Access the server through the terminal program, and then call installation directory and logs to check if it is installed successfully.
This guide is based on CentOS 7.8.
- Check LEMP component installation directory information
# ls /root/lemp
conf lemp_info.sh lemp_restart.sh
- Check LEMP web root directory information
# ls /ncp/data/www
50x.html index.html ncp ncp.jquery.js
Check PHP information
Create the PHP information file and check if the PHP and PHP modules are installed successfully.
Enter the following command to create the PHP information file.
echo "<?php phpinfo(); ?>" > /ncp/data/www/phpinfo.php
NoteWhen a permission error occurs when running commands, change Linux permissions.
Enter
http://{public ip address}/phpinfo.php
in the web's address window and run it.View relative information on the LEMP's PHP information page displayed on the web browser.
If you have checked all the information, delete the PHP information file for security reasons. Enter the following commands to delete files.
rm /ncp/data/www/phpinfo.php
Manage LEMP service
While you use the service, you can stop running or restart the components manually, or check the components' properties and process.
Stop/run LEMP components
When you need to stop or run components manually, use the following commands:
Stop and run all LEMP components
[root@lemp ~]# LEMP_HOME=/root/lemp [root@lemp ~]# $LEMP_HOME/lemp_restart.sh --------------------------------------------------------------- [Info] LEMP Service Re-start --------------------------------------------------------------- OS Information : CentOS Linux release 7.8.2003 (Core) --------------------------------------------------------------- [NCP LEMP] nginx re-start --------------------------------------------------------------- [Info] nginx.service is stopped. [Info] nginx.service is started. --------------------------------------------------------------- [NCP LEMP] mysqld re-start --------------------------------------------------------------- [Info] mysql.service is stopped. [Info] mysql.service is started.
Check LEMP component installation status
[root@lemp ~]# LEMP_HOME=/root/lemp [root@lemp ~]# $LEMP_HOME/lemp_info.sh --------------------------------------------------------------- General Information of NCP LEMP Products --------------------------------------------------------------- NCP LEMP Default Website : http://(your_public_ip) NCP LEMP Default Root Directory : /ncp/data/www NCP LEMP MySQL root init password :(your_server_hostname) --------------------------------------------------------------- [NCP LEMP] httpd version --------------------------------------------------------------- nginx version: nginx/1.22.1 --------------------------------------------------------------- [NCP LEMP] mysql database version --------------------------------------------------------------- mysql Ver 14.14 Distrib 5.6.35, for debian-linux-gnu (x86_64) using EditLine wrapper --------------------------------------------------------------- [NCP LEMP] php version --------------------------------------------------------------- PHP 7.2.34 (cli) (built: Oct 1 2020 13:37:37) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Nginx service
Stop and run- Stop:
systemctl stop nginx
- Run:
systemctl start nginx
- Stop:
Nginx service
Check process[root@lemp ~]# ps -ef | grep nginx root 3851 1 0 08:59 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nginx 3852 3851 0 08:59 ? 00:00:00 nginx: worker process
php-fpm service
Check process[root@lemp ~]# grep php-fpm root 3834 1 0 08:59 ? 00:00:00 php-fpm: master process (/etc/php-fpm.conf) nginx 3836 3834 0 08:59 ? 00:00:00 php-fpm: pool www nginx 3837 3834 0 08:59 ? 00:00:00 php-fpm: pool www nginx 3838 3834 0 08:59 ? 00:00:00 php-fpm: pool www nginx 3839 3834 0 08:59 ? 00:00:00 php-fpm: pool www nginx 3840 3834 0 08:59 ? 00:00:00 php-fpm: pool www
mysqld/mysql service
Stop and run- Stop:
systemctl stop mysql
- Run:
systemctl start mysql
- Stop:
mysqld/mysql service
Check process[root@lemp ~] ps -ef | grep mysqld mysql 8152 1 0 16:22 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr mysql 8406 8152 0 16:22 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=wp-1.err --pid-file=wp-1.pid --socket=/var/lib/mysql/mysql.sock --port=3306
Change MySQL root password
When you install LEMP, MySQL DB's root password is set as your host name. Before you use it, change the password to protect your security.
Enter the following commands to change the password.
[root@lemp ~]# mysql_secure_installation
...
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we will need the current
password for the root user. If you have just installed MySQL, and
you haven not set the root password yet, the password will be blank,
so you should just press enter here.
...(rest omitted)