Ask your Question

PEOPLE YOU MIGHT KNOW

Ashish
Ashish

CO-FOUNDER

Hayward,  United States
Simran
Simran

New delhi,  India
yash
yash

hello

surat,  India
Purpletree
Purpletree

Magento and Opencart Extension

Noida,  India
Brand
Brand

Top Digital Marketing Company In Delhi NCR

Gurgaon,  India

Write to us

Ask Question

Setup Virtual Host on Nginx for Magento

Pushpendra Singh

1. Create your project folder at path var/www/html

    cd /var/www/html

      mkdir magentodemo                // create project folder if you have not created any folder yet

 

2.Create a virtual host for your Magento store

    sudo nano /etc/nginx/sites-available/magentodemo.com

3. Add the below configuration in the host file

    upstream fastcgi_backend {

    server unix:/run/php/php7.1-fpm.sock;

   }

   server {

      error_log /var/log/nginx/magentodemo-error.log;

      listen 80;

      server_name localhost.magentodemo.com;

      set $MAGE_ROOT /var/www/html/magentodemo;

      include /var/www/html/magentodemo/nginx.conf.sample;

  }

 

Replace magentodemo.com with your domain name

 

4. Activate the newly created virtual host by creating a symlink to the /etc/nginx/sites-enabled directory

 

    ln -s /etc/nginx/sites-available/magentodemo.com /etc/nginx/sites-enabled/

5. Test the configuration

     nginx -t

 

6. Create an entry in your host file

     sudo nano /etc/hosts

     An entry like below in host file

    127.0.0.1 localhost.magentodemo.com

 

7. Hit the url on your browser

    http://localhost.magentodemo.com

It Should work !!

 

Pushpendra Singh

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site