Skip to main content
Version: 1.0

Deploy PHP app

Deploy Your PHP application

To deploy PHP application on LAMP, you need to add VirtualHost for it

VirtualHost is vhost configuration segment. Each application must correspond to a unique VirtualHost in vhost.conf / default.cong

Overall, just need two steps:

  1. Upload source codes of applicaiton
  2. Add new VirtualHost vhost configuration segment

Deploy fisrt application

There is a example application in LAMP, we sugget you to replace the example application for deploy first application:

  1. Use WinSCP to connect Cloud Server

  2. Delete all files in the folder /data/wwwroot/www.example.com, but don't delete www.example.com

  3. Upload your application's codes to the folder: /data/wwwroot/www.example.com

  4. Modify the virtual host configuration file to realize operations such as binding domain and modifying website directory

  • Apache<VirtualHost *:80>...</VirtualHost>
  • Nginxserver{}
  1. Save virtual host configuration file and then restart service

    # restart Apache
    systemctl restart httpd

    # restart Nginx
    systemctl restart httpd
  2. Using the Chrome or Firefox to visit: http://domain or http://IP/mysite2 to visit your application

Deploy second application

Start to deploy the second application, you should add new VirtualHost segment to the file vhost.conf

  1. Use WinSCP to connect Cloud Server,create a new "mysite2" website directory under /data/wwwroot

  2. Upload your application's codes to the folder::/data/wwwroot/mysite2

  3. Edit the Virtual machine host configuration file file to get the code snippet according to the scenario:

    Web Server场景获取代码段
    Apache有域名,通过 http://域名 访问网站获取
    没有域名,通过 http://IP/mysite2 访问网站获取
    Nginx有域名,通过 http://域名 访问网站获取
    没有域名,通过 http://IP/mysite2 访问网站获取
  4. Save virtual host configuration file and then restart service

    # restart Apache
    systemctl restart httpd

    # restart Nginx
    systemctl restart httpd
  5. Using the Chrome or Firefox to visit: http://domain or http://IP/mysite2 to visit your application

Deploy more application

Deploy more application is the same with Deploy second application

Finally, we know the new and summarize the steps of the LAMP deployment site:

  1. Upload the website code
  2. Bind the domain name (not necessary)
  3. Add the site configuration or modify the sample site configuration
  4. Increase the database corresponding to the site (not necessary)
  5. Enter the installation wizard

Maintain PHP Environment

Refer to:《PHP Guide》 and 《PHP Advanced》