Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Fix an Nginx virtual-host permission error by first proving which server block and filesystem path handled the request, then granting the Nginx worker only directory traversal and file-read access. Check the loaded configuration, inspect the error log, verify the actual worker account, test every directory in the path, account for SELinux where applicable, and retest with the correct Host header. Do not use recursive chmod 777: it creates unnecessary write access and may not solve a mandatory-access-control denial.

Use this order to repair the problem safely

Follow these steps in order. Changing permissions before confirming the active virtual host often fixes the wrong directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Capture the failing request. Record the URL, the hostname in its address, whether the URL ends with a slash, and the HTTP status. A request sent with the wrong hostname can select a different virtual server.
  2. Find the active configuration. Use nginx -V 2>&1 to see the compiled configuration path, inspect the included files, and locate the matching server_name, root, location, and any alias directives.
  3. Resolve the exact path. Nginx normally appends the request URI to the applicable root. A more-specific location can provide another root, while alias constructs the path differently. Use the path shown in the error log as the authority.
  4. Read the error log while reproducing the request. Common Linux locations are /var/log/nginx/error.log and /var/log/nginx/access.log. The error entry normally identifies the path and an operating-system error such as permission denied or no such file.
  5. Identify the worker account. Check the user directive and the running worker process. Do not assume the account is www-data or nginx; package defaults and custom builds differ.
  6. Inspect every path component. Run namei -l /absolute/path/to/document (or an equivalent inspection) and check owner, group, mode bits, and ACLs on every parent directory and on the target file.
  7. Grant the minimum access needed. Give the worker execute/traverse permission on every parent directory and read permission on static files. Preserve deployment ownership when possible; use a group or ACL for controlled collaboration.
  8. Check mandatory access control. On SELinux systems, inspect contexts with ls -Z and review audit records if Unix permissions look correct but access is still denied.
  9. Validate and reload. Run sudo nginx -t. Reload only after a successful test, request the URL with the intended hostname, and watch the error log for the new result.

How Nginx selects a virtual host and filesystem path

The hostname selects the server block

Nginx compares the request’s Host header with server_name values to choose a virtual-server block. DNS only gets the client to an IP address; it does not guarantee that the request reaches the block you are editing. A browser, proxy, health checker, or command-line request using another hostname can therefore land on a default server or another site’s block.

When testing, send the intended hostname explicitly if necessary:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
curl -i -H 'Host: example.com' http://127.0.0.1/

For HTTPS, the TLS server-name indication and certificate selection also matter. Test through the real hostname when possible, and use the access log to confirm which request arrived.

The root directive supplies the base path

With root /var/www/example.com/public;, a request for /assets/app.css normally maps to /var/www/example.com/public/assets/app.css. The URI is appended to the effective root; it is not a search through every directory on the server. A missing file at that computed path is a path or deployment problem, not automatically a permission problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Location-level settings can change the result

Nginx evaluates the most specific applicable location. A root inside that location can replace the server-level root for matching requests. An alias maps the location to a specific filesystem name instead of simply appending the URI, so a seemingly correct permission change under the server-level root may have no effect.

Configuration element What to verify Typical diagnostic mistake
server_name The request hostname matches the intended block. Editing a new site’s directory while the request is handled by the default server.
root at server scope The base directory is the deployed document root. Granting access to an old release or parent directory that is not used.
root at location scope A more-specific location has not replaced the expected root. Static files work in one URL prefix but fail in another.
alias The URI-to-path substitution is understood exactly. Appending the URI manually and checking a path Nginx never opens.

Confirm the configuration that is actually loaded

Nginx reads a compiled-in configuration path and then processes included files. Package layouts commonly place configuration under /etc/nginx, but the location can vary by distribution or build.

  1. Run nginx -V 2>&1 and note the compiled --conf-path.
  2. Open that main file and follow its include directives to the virtual-host files.
  3. Search for the hostname, then inspect the complete matching server block and all nested location blocks.
  4. Check for a second definition of the same hostname, a default server on the same listen address, an unexpected redirect, or an alias.
  5. Run sudo nginx -t. Do not reload a configuration that fails syntax or file-validation checks.

A successful syntax test proves that Nginx can parse the files; it does not prove that the worker can traverse your document root. That is why configuration validation and filesystem inspection are separate steps.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Use the logs to distinguish path errors from permission errors

Watch the error log while making one request. On many Linux installations the main files are /var/log/nginx/error.log and /var/log/nginx/access.log; a custom error_log directive may send entries elsewhere.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo tail -f /var/log/nginx/error.log

Look for the absolute filename Nginx attempted to open and the operating-system reason. A message containing a permission-denied error points to Unix permissions, ACLs, or a security policy. A no-such-file error points first to the selected root, location mapping, URI, deployment, or index name. Record the status in the access log as well, because a 403 can be produced by more than one Nginx rule.

When a request ends in /, Nginx performs index-file lookup. The default index name is index.html unless the configuration changes it. If the directory is reachable but no configured index exists, the result is commonly a 404; directory-index settings or location rules can instead produce a 403. The error-log path and reason tell you which case you have.

Identify the account that needs access

The master process may run as root while worker processes run as an unprivileged account. The account named by the Nginx user directive is a useful starting point, but verify the running workers because service overrides and custom builds can change it.

ps -eo user,pid,cmd | grep '[n]ginx: worker'

Use the account shown for the worker when evaluating ownership, group membership, and ACL entries. If you change group membership, restart or reload the relevant service as required for the new credentials to be used; do not assume an already-running worker has acquired a newly assigned supplementary group.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Check traversal on every directory

Unix directory permissions differ from file permissions. The execute bit on a directory means “traverse”: it permits a process to pass through that directory when it already knows a name. Nginx needs traversal on every component between the filesystem root and the document, such as /var, /var/www, /var/www/example.com, and /var/www/example.com/public. The target file then needs read permission for the worker’s effective user or one of its groups.

namei -l /var/www/example.com/public/index.html

Read the output from left to right. A single parent directory without the required execute permission blocks the request even if index.html is mode 0644 and appears world-readable. Also inspect ACLs, which can grant or restrict access beyond the traditional owner/group/other mode display.

Check the file itself and the directory containing it:

stat /var/www/example.com/public/index.html
ls -ld /var /var/www /var/www/example.com /var/www/example.com/public
getfacl /var/www/example.com/public/index.html

Use the exact path printed in the Nginx error entry, not a path inferred from memory. Symlinked deployment directories and release layouts can make two visually similar paths resolve to different permission chains.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Grant least-privilege access

Static files with a separate deployment owner

For a static site, keep ownership with the site or deployment account and make directories traversable and files readable by the Nginx worker’s group. A common pattern is directories at 0755 and regular files at 0644, but choose modes that match your security requirements and existing group design rather than applying them blindly.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
sudo find /var/www/example.com/public -type d -exec chmod 0755 {} +
sudo find /var/www/example.com/public -type f -exec chmod 0644 {} +

Those commands deliberately treat directories and files differently. Review the result before using them on a tree containing uploads, sockets, private configuration, or executable scripts. Never run a blanket recursive chmod 777; it grants write access to every local user and still does not correct an SELinux context denial.

Use a group when Nginx and deployment both need controlled access

If a deployment account must write files while Nginx only reads them, create or use a dedicated site group, add the appropriate accounts, and set group ownership on the site tree. Give directories group traversal and files group read access. If new files must inherit the group, a setgid directory or the deployment tool’s umask may be appropriate; apply those deliberately and verify the result.

sudo chgrp -R web-example /var/www/example.com/public
sudo find /var/www/example.com/public -type d -exec chmod 0750 {} +
sudo find /var/www/example.com/public -type f -exec chmod 0640 {} +

The numeric modes above are an example for a design in which the owner and the web-example group need access and all other users do not. Confirm that the actual Nginx worker belongs to that group before relying on it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use ACLs for a narrow exception

An ACL can grant the worker read or traverse access without changing the primary owner or broad “other” permissions. Inspect existing ACLs first with getfacl, then add only the entries required for the site. Keep default ACLs in mind: they affect newly created files and can unintentionally expose future content if they are broader than intended.

After any mode, ownership, or ACL change, rerun namei -l and inspect the target file. A permission fix should be explainable component by component: which account is accessing, which directory grants traversal, and which file grants read access.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check SELinux when Unix permissions look correct

On systems enforcing SELinux, mode bits are only one authorization layer. Standard web roots receive contexts expected by the distribution’s Nginx policy. A custom document root can have a context that prevents the worker from reading it even when owner, group, and mode output look adequate.

  1. Inspect the context on the directory and file with ls -Z /path/to/document.
  2. Review SELinux audit records for a denial corresponding to the request.
  3. Compare the custom path’s labels with those on a known-working web root.
  4. If the path needs a non-default label, define a persistent file-context rule according to your distribution’s SELinux documentation, then restore the context.
  5. Retest the request and confirm that the denial no longer appears.

Do not disable SELinux or switch the system to permissive mode as a routine fix. A persistent context rule preserves the protection after relabeling or rebooting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Interpret 403, 404, and index behavior correctly

Observed result What it commonly means Next check
403 with permission-denied text in the error log The worker cannot traverse a parent, read the file, or pass a mandatory-access-control check. Worker identity, namei -l, ACLs, and SELinux audit records.
404 with no-such-file text The computed path or filename does not exist. server_name, effective root/alias, URI spelling, deployment, and index setting.
Directory URL ending in / returns 404 No configured index file was found, or an explicit try_files rule returned 404. Confirm the index filename and whether the file exists at the logged path.
Directory URL returns 403 without a file denial Directory listing may be disabled, or a location/access rule may reject the request. Inspect index, autoindex, location, and access-control directives.

Do not change permissions to solve every 403. Nginx can deliberately return 403 because of directory-index policy or a location rule, even when the filesystem is readable.

Use try_files to make static path handling explicit

For a conventional static virtual host, try_files can check whether the requested file or directory exists and return a controlled 404 when neither does. It does not grant permission; the worker still needs traversal and read access.

server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com/public;
index index.html;

location / {
try_files $uri $uri/ =404;
}
}

With this configuration, a request for /css/site.css checks the file under /var/www/example.com/public/css/site.css. A request for a directory can then use the configured index processing. If the path is absent, Nginx returns 404 rather than passing an unexpected URI to another handler.

Validate, reload, and retest without losing the evidence

  1. Run sudo nginx -t after every configuration edit.
  2. Reload only after the test reports success, using the service-management method appropriate to your installation.
  3. Make one request with the intended hostname and URL, preferably with curl -i so the status and headers are visible.
  4. Watch the error log at the same time and confirm that the logged path is the one you inspected.
  5. If the error changes from permission denied to 404, the access layer is likely fixed and path or index resolution is now the remaining issue.
  6. If the same denial remains, compare the worker account, every path component, ACLs, and SELinux context again; a reload alone cannot change filesystem authorization.

Common failure patterns and the precise correction

Failure pattern Why the first fix did not work Correction
Wrong virtual host The DNS name or Host header selected another server block. Match the request hostname to server_name, then inspect that block’s logs and root.
Wrong root or alias Permissions were changed under a directory Nginx never opens. Use the absolute path in error.log and account for location-level mapping.
Parent lacks traversal The file is readable, but the worker cannot pass an earlier directory. Use namei -l and grant execute/traverse on each required parent.
Worker-account mismatch Access was granted to www-data while workers run as another account, or vice versa. Verify the user directive and running process, then adjust group or ACL entries.
SELinux denial Traditional mode bits are adequate but the security context is not allowed. Check ls -Z and audit records; apply a persistent context rule for a custom web root.
Missing index The directory is reachable, but its configured index file is absent or named differently. Check the index directive and the exact directory path; do not make the directory world-writable.
Configuration edit not loaded The file was changed outside the compiled configuration path or an include was omitted. Use nginx -V, inspect includes, run nginx -t, and reload the validated configuration.

A compact decision checklist

  • Hostname: Does the request’s Host match the intended server_name?
  • Path: What absolute filename does the error log show?
  • Mapping: Did a location-level root or alias change the path?
  • Worker: Which account is the running worker actually using?
  • Traversal: Does that account have execute permission on every parent directory?
  • File: Does it have read permission on the target file?
  • Policy: Do ACLs or SELinux add a denial?
  • Index: If the URL ends in a slash, is the configured index present?
  • Configuration: Did sudo nginx -t pass, and was the validated configuration reloaded?

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.