Installed via Scoop and started as a service using NSSM is the web server application NGINX. It is configured to use a PHP-FPM setup (PHP runs as a service in the background, forking service workers whenever needed).
Hopefully you will not have to change anything in the base configuration of NGINX. However, you still need to define your own “servers” (“Virtual Hosts”). This can be done by editing the ~/nginx.conf in your user home directory.
The server configuration for a Contao project will look like this:
# yourproject.local
server {
listen 80;
server_name yourproject.local;
root C:/Users/YOURUSER/www/yourproject/web;
include contao.conf;
}
This server configuration will serve any web pages under the domain yourproject.local with the document root being in C:/Users/YOURUSER/www/yourproject/web. It also includes a global contao.conf, which might look like this:
# pass any request to the app.php
location / {
try_files $uri /app.php$is_args$args;
}
# pass app.php and app_dev.php access to the fastcgi handler
location ~ ^/(app|app_dev)\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi.conf;
#internal;
}
# do not log 404 access to static files
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
log_not_found off;
}
# do not log access to favicons
location = /favicon.ico {
log_not_found off;
access_log off;
}
# do not log access to robots.txt
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# do not allow access to .htaccess files
location ~ /\.ht {
deny all;
}
Of course you also need to set up the local domain - yourproject.local in this case.
After changing the configuration you need to restart the NGINX service:
sudo nssm restart nginx
The sudo command is installed via Scoop. It enables you to execute any commands on the fly with administrator rights under Windows - without having to start the console application with administrator rights.