Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to migrate websites to LNMP or LAMP site-building environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how websites can be migrated to LNMP or LAMP. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Drop the VPS panel! The method of smooth migration of website to LNMP or LAMP site environment

1. Installation of LNMP or LAMP station environment

1. LNMP official website:

Official home page: https://lnmp.org/

2. LNMP refers to Nginx, MySQL, PHP,LAMP refers to Apache, MySQL, PHP. As long as your original VPS panel uses LNMP or LAMP, you can migrate directly to the LNMP one-click installation package introduced in this article.

3. Before installing LNMP or LAMP, you should pay attention to VPS:

Support for CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian Linux system

Need more than 2GB hard disk spare space

MySQL 5.6and MariaDB 10 must have more than 1G of memory

More than 128m of memory, Xen needs to have SWAP,OpenVZ and at least vSWAP or burst memory above 128MB

4. LNMP and LAMP take a long time to compile. In order to avoid accidents, we can use the screen tool to log in to your VPS host and execute: screen-S lnmp. If prompted that the screen: command not found command does not exist, you can execute: yum install screen or apt-get install screen installation.

5. Install LNMP and execute the following command:

Wget-c http://soft.vpser.net/lnmp/lnmp1.3.tar.gz & & tar zxf lnmp1.3.tar.gz & & cd lnmp1.3 & &. / install.sh lnmp

6. If you want to install LAMP, execute the following command:

Wget-c http://soft.vpser.net/lnmp/lnmp1.3.tar.gz & & tar zxf lnmp1.3.tar.gz & & cd lnmp1.3 & &. / install.sh lamp

7. The beginning of the compilation is to set the Root password of your MysqL.

8. Choose whether to install MySQL InnoDB, and enter the serial number of MySQL or MariaDB version, as shown below:

9. Enter the serial number of the PHP version and choose whether to install memory optimization. (generally speaking, the Default option has fewer problems after installation, and the program compatibility is relatively strong. If you do not choose the option during installation, you can directly choose the default one. )

10. Because we are installing LAMP, we also need to set up your administrator account mailbox and select the Apache version.

Wait for more than 30 minutes, and your VPS host will show that LNMP or LAMP has been installed successfully.

12. Open the IP address, you can see the successful pages of LNMP and LAMP, and open the probe to see the server compilation engine. Apache is installed here.

2. LNMP or LAMP must-have cache extension

1. LNMP or LAMP one-button package already provides the installation of extensions to PHP cache and acceleration classes, such as eAccelerator, xcache, memcached, imageMagick, ionCube, redis, opcache, etc., which is very easy to configure.

1. PHP accelerator: eAccelerator installation. Enter your LNMP directory: cd lnmp1.2-full, execute the command:. / addons.sh install eaccelerator, pay attention to distinguish the different versions of the corresponding PHP version: eaccelerator 0.9.5.3 supports PHP 5.2, PHP 5.2,5.3, PHP 5.2,5.3,5.4.

2. The following figure indicates that eAccelerator has been successfully installed. If you uninstall it, execute:. / addons.sh uninstall eaccelerator.

3. Open the PHP probe and you can see that eAccelerator has been run successfully.

4. Memory object caching system: Memcached. Enter your LNMP directory: cd lnmp1.2-full and execute the command:. / addons.sh install memcached. Choose php-memcache or php-memcached extension according to your needs. Currently, discuz x uses the former, while Wordpress uses the latter.

5. The Memcached compilation time is about ten minutes, and the memcache statistics is only a few minutes. If you see the following picture, it means that the compilation has been successful. Uninstall, execute:. / addons.sh uninstall memcached

6. Open the PHP probe and you can see that Memcached has been compiled successfully.

7. PHP opcode buffer: XCache. Because XCache and eAccelerator act similarly, they can only choose one or the other. Enter the unzipped directory of lnmp and set an administrator password when you install:. / addons.sh install xcache,XCache.

Third, LNMP or LAMP to create a website binding domain name

1. LNMP or LAMP to create a new website, you need to go to the LNMP directory: cd lnmp1.2-full, then execute the command: lnmp vhost add, then enter your website domain name, type "Y" again, and continue to enter the domain name without www. At the bottom, you need to set up the directory of the website, and the path should be a full path that starts with /.

2. Then set whether to enable logging. For Apache, you need to fill in your administrator's mailbox, and then create a MysqL database for the website.

3. After creating the virtual host, you can see the root directory of the new website under your VPS website directory. The default is under / home/wwwroot/.

4. All the newly created databases are under / usr/local/mysql/var/.

5. PHPMyAdmin recommends renaming it in / home/wwwroot/default/, to avoid being accessed by outsiders. If XCache is installed, you can also see it in / home/wwwroot/default/, where we can access the XCache administration interface.

IV. Smooth migration of website data to the new VPS host

1. We have successfully configured the LNMP or LAMP site building environment above. To avoid database connection errors in our migrated website, it is recommended to create a database name, user name and password that is the same as the original MysqL database when binding the domain name to create the database.

2. The smooth migration of website data here mainly uses two methods previously introduced by the tribe: one is the fast moving method of the VPS host: it is packaged and transmitted while decompressing, and the other is the fast moving of SCP remote VPS. Both methods of moving can save you the trouble of transferring data from local transfer sites and migrate data directly between computer room and computer room.

3. For example, find the root of the site on the old VPS host.

4. Move the public_html directory under / www/web/freehao123_info on the original VPS to the new VPS, and execute the command:

Tar czf-public_html | ssh root@50.31.252.181 tar xzf-- C / www/web/freehao123_info/public_html

5, for MysqL database moving is the same, find the original mysql database file and log directory, use the above command (pay attention to replace the corresponding directory), you can move the database to the new VPS host. The bandwidth between the computer room and the computer room is sufficient, this method is most suitable for large websites.

5. Environmental problems in the establishment of LNMP or LAMP

1. The installation of eaccelerator for LNMP or LAMP will cause the phpmyadmin to go blank and cannot be opened. This problem has been encountered by the tribe, and the environment is: mysql5.5.42 php5.4.40 Apache2.2.29 eAccelerator 1.0. as long as the eAccelerator is uninstalled and the phpmyadmin is opened, it is normal.

2. The PHP optimization acceleration component opcache causes the 500th error of Wordpress. This problem should be the problem of the tribe's Wordpress itself, because Wordpress uses a lot of cache plug-ins, which leads to server errors after installing opcache. It is normal to uninstall opcache.

3. Log and backup problems of LNMP or LAMP. This may not be suitable for friends who have just transferred from the VPS control panel, but fortunately, under the directory of the LNMP1.2 installation package, there is a tools directory with commonly used backup scripts backup.sh,nginx log cutting scripts cut_nginx_logs.sh,SSH protection installation scripts denyhosts.sh and fail2ban.sh,MySQL/MariaDB root password reinstallation tools reset_mysql_root_password.sh and PHP function auxiliary deletion tool remove_disable_function.sh.

Thank you for reading! This is the end of the article on "how to migrate the website to LNMP or LAMP environment". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report