जब nginx संकलित किया जाता है तो डिफ़ॉल्ट स्क्रिप्ट के prefixविकल्प से संबंधित होता configureहै; यहाँ डेबियन से कुछ अजीब नमूना है:
% nginx -V | & tr ' ' "\n" | fgrep -e path -e prefix
--prefix=/etc/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-log-path=/var/log/nginx/access.log
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--lock-path=/var/lock/nginx.lock
--pid-path=/var/run/nginx.pid
बाद में, का डिफ़ॉल्ट मान rootहै करने के लिए सेट htmlनिर्देशिका (के अनुसार के प्रलेखन rootके निर्देश है, जो भीतर होने वाला) prefix, के रूप में देख कर सत्यापित किया जा सकता $document_rootएक सरल विन्यास फाइल से चर:
# printf 'server{listen 4867;return 200 $document_root\\n;}\n' \
>/etc/nginx/conf.d/so.10674867.conf
# nginx -s reload && curl localhost:4867
/etc/nginx/html
हालाँकि, डेबियन जैसे दुष्ट वितरण इसे थोड़ा संशोधित करते हैं, जिससे आपको अतिरिक्त मनोरंजन मिलता रहे:
% fgrep -e root -e include /etc/nginx/nginx.conf
include /etc/nginx/mime.types;
#include /etc/nginx/naxsi_core.rules;
#passenger_root /usr;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
% fgrep -e root -e include \
/etc/nginx/conf.d/*.conf /etc/nginx/sites-enabled/*
/etc/nginx/conf.d/so.10674867.conf:server{listen 4867;return 200 $document_root\n;}
/etc/nginx/sites-enabled/default: root /usr/share/nginx/www;
/etc/nginx/sites-enabled/default: # include /etc/nginx/naxsi.rules
/etc/nginx/sites-enabled/default: # root /usr/share/nginx/www;
/etc/nginx/sites-enabled/default: # include fastcgi_params;
/etc/nginx/sites-enabled/default: # deny access to .htaccess files, if Apache's document root
/etc/nginx/sites-enabled/default:# root html;
/etc/nginx/sites-enabled/default:# root html;
इसलिए, डेबियन के इस उदाहरण पर, आप देख सकते हैं कि रूट अंत में सेट है /usr/share/nginx/www।
लेकिन जैसा कि आपने नमूना सर्वर कॉन्फ़िगरेशन के साथ देखा था जो $document_roothttp पर इसके मूल्य की सेवा करेगा , nginx को कॉन्फ़िगर करना इतना सरल है कि आप rootअपनी सटीक कॉन्फ़िगरेशन को एक पंक्ति या दो के मामले में लिख सकते हैं, जो आपकी सटीक आवश्यकताओं को पूरा करने के लिए आवश्यक निर्दिष्ट करता है ।