I'm trying to set up Nginx on my Windows development environment. I can't find how to create something similar to "sites-enabled"
on Linux where Nginx would look for (links to) active virtual host configurations.
Is there a way to do something similar with a directory with shortcuts to the actual configuration files and Nginx scanning that directory? Or is there another way to hook up a virtual host configuration other than copying the host configuration to nginx.conf
?
To enable a website, you must create a symbolic link inside the /etc/nginx/sites-enabled directory pointing to the actual vhost file in /etc/nginx/sites-available . The nginx. conf file reviews the contents of the sites-enabled directory and determines which virtual host files to include.
The primary Nginx configuration file is /etc/nginx/nginx. conf . To inspect the configuration, use the cat /etc/nginx/nginx. conf command, and search for the server directive.
Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf .
In windows you have to give full path of the directory where the config files are located. There are two files to update: nginx.conf, which tells nginx where to find web sites, and localhost.conf, which is the configuration for a web site.
It is assumed that nginx is installed in C:\nginx
. If the installation directory is at another path, you will have to update that path accordingly, wherever it appears in the following two configuration files.
Location: C:\nginx\conf
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #to read external configuration. include "C:/nginx/conf/sites-enabled/*.conf"; }
Location: C:\nginx\conf\sites-enabled
server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With