To deploy a website in LNMP, you need to know the following six points:



The details of deploying a website or multiple websites, with or without domain names, are slightly different.


Deployment the first site


In fact, the LNMP environment already has a sample website by default (although there is only one unused file), obviously the best way for you to deploy the first website is to modify the sample website to your website, just two step:


  1. Using SFTP to upload your code to the directory: /data/wwwroot/www.example.com
  2. Run a command to modify file permissions(Non-essential)
    chown -R nginx.nginx /data/wwwroot
    Visit the URL http://Internet IP  on your PC,you can access to site now
  3. If you want to bidding Domain Name,modify the www.example.com directory, you should modify the vhosts hosts configuration section in httpd-vhosts.conf 
  4. Please save the vhost.conf if you have modify it, and then restart httpd service
    systemctl restart nginx
    systemctl restart php-fpm


Deployment the second site


The second deployment, you should add the vhost template segment in the default.conf


  1. Add a new folder in the /data/wwwroot, suggest the name is "mysite2"
  1. Save the vhost.conf and restart httpd
systemctl restart nginx
systemctl restart php-fpm
  1. Using the Chrome or Firefox on your PC to visit: http://Domain or http://Internet IP to access your site2


Finally, we know the new and summarize the steps of the LNMP 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


Attachment: Description of configuration file items


Items

description

ServerName

Primary domain

ServerAliasSecond domian,not required
DocumentRoot

The real website storage directory must be accurate

Directory

The real website storage directory must be accurate

ErrorLogerror logs directory
CustomLog

visit logs directory