How to setup nginx multi-site virtual hosts




















Refer to Create websites and Create store views for help locating these values. This section discusses how to load websites on the storefront. You can use either websites or store views; if you use store views, you must adjust parameter values accordingly. You must complete the tasks in this section as a user with sudo privileges. By using just one nginx virtual host file , you can keep your nginx configuration simple and clean. By using several virtual host files, you can customize each store to use a custom location for french.

This configuration expands upon Magento Nginx Configuration. Finally, we must update our DNS settings to associate the IP address of our web host with our domain names. Wherever you bought your domain names, add an A record with the value of the IP address for your web host. Pin As always, DNS changes may take some time up to 48 hours, but typically less to propagate. What this means is that you might have to wait a bit before your domain name resolves to your website.

Open a web browser and load your websites. Configure Nginx to Host Multiple Websites In this section, we will show you how to host two websites named web1.

You can check the Nginx server status with the following command: systemctl status nginx Best method to host multiple websites is to create a separate document root directory and configuration file for each website. Next, create a index. First, create a virtual host configuration file for the web1. You should see both websites with the content we have created earlier: web1. Then, restart Nginx and the correct PHP-FPM service to apply the configuration changes: systemctl restart nginx systemctl restart php 7.

Need help? If you need any help regarding this article or if you have any questions regarding hosting in general, please be in touch. What is Webdock? Webdock is a world-class hosting provider aimed at professionals and semi-professionals with the goal of providing an absolutely awesome and rock-solid hosting experience. Now that you've located the sites-available folder, you'll want to cd into that folder and create a virtual host config file for testsite.

A config file can either be created from scratch or you can copy the default configuration file and make any required changes. In this case, were going to copy the default file that's currently within the sites-available directory. To do so, use the following snippet:. You will then need to modify the contents to testsite. Once you're done editing your virtual host file, be sure to save the file. Next, you'll need to create a symbolic link in sites-enabled to the newly created nginx virtual host files within the sites-available folder:.

Your virtual host file should now be properly configured for your new setup. Of course, there are many modifications that can be made such as adding leverage browser caching support or CORS support, although the example above should be enough to get you started. Once you've properly defined your DNS settings at the web host level or whichever DNS service provider you're using , you should now be able to access your site directly by entering the domain into a web browser.



0コメント

  • 1000 / 1000