After configuring the LNMP environment, the default site directory and database storage directory are in the system disk, so we need to transfer them to the data disk.
Change the Web site file directory
If you're using the LNMP one-click installation package, the default virtual host configuration environment is in the/usr/local/nginx/conf/vhost/directory:
vi/usr/local/nginx/conf/vhost/domain name. conf
You can open the corresponding virtual host configuration and then modify the site directory in it. Then execute: cp-a old directory new directory, chown www:www-r new directory.
Change MySQL Directory
1. Shut down the MySQL server:
/etc/init.d/mysql stop
2. The following new directory takes/data/mysql/as an example, and then copies the old directory's database to the new directory:
Cp-r/usr/local/mysql/var/*/data/mysql/
3. Assign the new directory to the MySQL user group:
Chown Mysql:mysql-r/data/mysql/
4. Modify the configuration file again:
Vi/etc/my.cnf
Find [mysqld], add datadir below =/data/mysql/Save
5. Start MySQL:
/etc/init.d/mysql start
LNMP notes: Changing the site file and MySQL database storage directory