Change document root in nginx for external drive

I have a scenario where I use window and ubuntu both along side on my machine, now I want my all sites to be shared across the OS, I have created a directory named 'common-sites' in D drive, and setup the drupal site with domain drupal-demo-8.com.

My Ubuntu has nginx, I want my common-sites to be available for Ubuntu as well.

Approach:

  • First login in ubuntu machine.
  • Mount D:\ drive with /media/window, using below commands:

This will list all available partition as follows:


  $ sudo fdisk -l
  /dev/sda1
  /dev/sda2
  ...
  sudo mkdir /media/windows
  sudo mount -t ntfs -o nls=utf8,umask=0222 /dev/sda1 /media/windows
  

Now change docroot in nginx site's configuration - for example my config is "drupal-demo-8.conf", which contains:


  server {
    listen 80;
    server_name drupal-demo-8.com;
    root /var/www/drupal-demo-8.com/docroot;
    index index.php;
    # For Drupal >= 7 clean url
    location / {
    try_files $uri /index.php?$query_string;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }
  }
  

Now change the docroot to : /media/windows/common-sites/drupal-demo-8.com/docroot;

Restart nginx

-:Done:-

Comments

Popular posts from this blog

How to setup Drupal 8 Multisite on nginx webserver with different domain.

Install drush globally using composer on WSL

Drupal views create exposed filter programmatically