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

For a secure Laravel VPS deployment, point Nginx at the application’s public/ directory—not the project root—and allow the PHP-FPM or web-server account to write only to storage/ and bootstrap/cache/. Keep .env, source code, dependencies, and other private directories outside the document root.

The exact Linux user, group, ACL, and numeric modes depend on your distribution and PHP-FPM pool. Identify the account running PHP-FPM on the target server, then grant it the minimum access required instead of applying chmod -R 777.

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

Use public/ as the only Nginx document root

Laravel’s front controller is public/index.php. Nginx should expose that directory and send requests for non-existent files to the front controller. Serving the project root can expose .env, application source, Composer metadata, logs, and other files that are not intended for direct download.

Recommended Nginx server block

Adapt the PHP-FPM socket and filesystem paths to the versions installed on your VPS:

#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.
server {
    listen 80;
    server_name example.test;
    root /var/www/example/current/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }

    location ~ /. (?!well-known).* {
        deny all;
    }
}

The socket shown is illustrative. Common installations use a versioned path, and some distributions use a TCP listener. Use the socket configured by your PHP-FPM pool. The important details are the root ending in /public, the try_files fallback to index.php, and a correct SCRIPT_FILENAME.

After changing the configuration, validate it with your distribution’s Nginx test command, then reload Nginx through the host’s service manager. Do not point a second server block, static-file alias, or temporary maintenance site at the Laravel project root.

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

What each Laravel directory is for

Directory Purpose Runtime access guidance
app/ Application code and most classes. Readable by the runtime; not writable during normal requests.
bootstrap/ Framework bootstrap code and generated framework files. The bootstrap/cache/ subdirectory must be writable by the runtime.
config/ Configuration files. Readable, normally not writable by PHP-FPM.
database/ Migrations, factories, and seeders. Readable for deployment tasks; keep it outside the web root.
public/ Front controller and public assets. This is the only directory Nginx should expose.
resources/ Blade views and raw, uncompiled assets. Readable; source files should not be directly downloadable.
routes/ Route definitions. Readable and private from HTTP.
storage/ Logs, compiled Blade templates, file sessions, file caches, and application-generated files. Writable by the PHP-FPM or web-server account.
storage/app/public/ User-generated files intended to be publicly reachable. Writable as part of storage/; publish through the storage link.
vendor/ Composer-installed dependencies. Readable by PHP; do not expose it through Nginx.

Laravel divides storage into app, framework, and logs. A request that writes a file session, cache item, compiled view, upload, or log therefore needs write permission somewhere below storage/.

Which folders need write permission?

Laravel’s deployment requirement is specific: the web-server process owner must be able to write to storage/ and bootstrap/cache/. Those paths cover generated caches, compiled views, logs, sessions, and application files. The rest of the release tree should remain read-only to the runtime account wherever practical.

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

Find the actual PHP-FPM identity

Do not assume that the account is www-data. Debian-based systems often use that name, while other distributions use nginx or a pool-specific account. Inspect the active PHP-FPM service and pool configuration, for example:

systemctl status php-fpm
sudo grep -R '^[[:space:]]*user[[:space:]]*=' /etc/php/*/fpm/pool.d /etc/php-fpm.d 2>/dev/null
sudo grep -R '^[[:space:]]*group[[:space:]]*=' /etc/php/*/fpm/pool.d /etc/php-fpm.d 2>/dev/null

Use the service and configuration path that exists on your VPS. If multiple pools serve different applications, identify the pool used by this virtual host; granting permissions to the wrong account will not fix the request.

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

A controlled POSIX group layout

A common pattern is a deployment owner plus a runtime group. Replace the variables below after verifying the real accounts:

APP=/var/www/example/current
DEPLOY_USER=deploy
RUNTIME_GROUP=www-data

sudo chown -R "$DEPLOY_USER:$RUNTIME_GROUP" "$APP"
sudo find "$APP" -type d -exec chmod 750 {} +
sudo find "$APP" -type f -exec chmod 640 {} +
sudo chmod -R g+rwX "$APP/storage" "$APP/bootstrap/cache"

This example makes the release readable and traversable by the group, then adds group write access only to Laravel’s two mutable locations. Substitute the runtime group used by your PHP-FPM pool. If Nginx serves static files as a different account, include that account in the access design rather than making the whole tree world-writable.

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.

Directory execute permission is required to traverse a path; read permission alone is not enough. Files need read permission for PHP to load code, while directories that receive generated files need write and execute permission.

When ACLs are a better fit

Access-control lists are useful when several deployment users, queues, scheduled jobs, or service accounts need different access and a single shared group is awkward. Grant an ACL to the specific runtime account on the two writable paths, and give it read and traverse access to the release tree. Review default ACLs for newly created files so that a deployment does not silently remove the required access.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
APP=/var/www/example/current
RUNTIME_USER=www-data

sudo setfacl -R -m u:$RUNTIME_USER:rwX "$APP/storage" "$APP/bootstrap/cache"
sudo setfacl -R -d -m u:$RUNTIME_USER:rwX "$APP/storage" "$APP/bootstrap/cache"

Use ACL commands only if the filesystem supports them and your team understands how they interact with ownership and umasks. POSIX groups are simpler and more portable; ACLs provide finer control for multi-user servers.

Why chmod -R 777 is the wrong fix

Mode 777 grants every local user and process read, write, and execute access. It hides the real ownership problem, increases the impact of a compromised process, and gives more access than Laravel requires. Restrict write permission to the runtime identity and the two documented directories. If a broad mode appears necessary, stop and inspect each parent directory, symlink, mount, owner, group, and PHP-FPM pool instead.

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.

Deployment procedure for a new VPS

  1. Create a private release path. Place the application under a directory such as /var/www/example/current; keep .env and all non-public directories there, not under a separate web-accessible root.
  2. Set Nginx’s root. Use /var/www/example/current/public. Configure the front-controller fallback and PHP-FPM socket as shown above.
  3. Verify the process account. Read the active PHP-FPM pool rather than copying an account name from another server.
  4. Make the release readable. The runtime must be able to traverse directories and read PHP files, configuration, views, and Composer dependencies.
  5. Make only Laravel’s mutable paths writable. Grant the runtime write access to storage/ and bootstrap/cache/ using a controlled group or ACL.
  6. Check the environment before caching. Confirm that .env contains the intended database, cache, queue, filesystem, URL, and application settings.
  7. Build deployment caches. Run php artisan optimize, or run the individual config:cache, event:cache, route:cache, and view:cache commands when you need separate control.
  8. Publish public uploads when needed. Run php artisan storage:link if files on the public disk must be reachable through URLs.
  9. Test as the runtime user. Check write access directly rather than relying on the command-line user, which may be different from PHP-FPM.
  10. Reload services. Reload PHP-FPM and Nginx through the service manager after pool or virtual-host changes, then make a request and inspect the application log.

How the public storage link works

Laravel stores public-disk uploads under storage/app/public. The command php artisan storage:link creates public/storage as a link to that directory. Nginx can then serve an upload at a URL beneath /storage without exposing the rest of storage/.

If the command succeeds but files return 404, inspect the link target and the parent-directory permissions:

ls -ld public/storage storage/app/public
readlink -f public/storage

On a release-based deployment, recreate or preserve the link in the new release, or place the shared upload directory outside individual release folders and link each release’s public/storage to it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Cache commands and the .env caveat

Run cache-building commands only after the intended environment is present. Once configuration is cached, calls to env() outside configuration files return null. Application code should read environment values through configuration entries, not call env() directly in controllers, jobs, views, or other runtime classes.

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.

If a deployment changes an environment value, rebuild the relevant cache before serving traffic. A stale configuration cache can look like a permissions or database problem even when file access is correct.

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

Troubleshoot “permission denied” methodically

The error names storage/framework, logs, sessions, or cache

  • Confirm the PHP-FPM account and group for this virtual host.
  • Inspect every parent directory with namei -l /var/www/example/current/storage; a missing execute bit on a parent blocks access.
  • Check ownership, group, and ACLs on storage/ and its subdirectories.
  • Test as the runtime identity: sudo -u www-data test -w /var/www/example/current/storage && echo writable, replacing www-data with the verified account.
  • Review disk space, read-only mounts, and security policies if ownership and mode checks pass.

The error names bootstrap/cache

Apply the same identity test to bootstrap/cache. Deployment scripts often recreate this directory as the deployment user with restrictive permissions, so check it after every release. The runtime needs to create and replace generated cache files there, not merely read existing files.

CLI commands work, but web requests fail

Commands run from an SSH shell use your login account, while web requests use PHP-FPM. A successful php artisan command therefore does not prove that the web process can write. Repeat the test with the PHP-FPM account and inspect the web-server error log for the exact path.

Uploads work until the next deployment

This usually indicates that writable data lives inside a release directory that was replaced. Keep persistent uploads in a shared location, link storage appropriately, and ensure each new release has a writable bootstrap/cache. Do not solve rollback problems by making the entire parent directory writable.

The storage link exists but is inaccessible

Check that public/storage points to storage/app/public, that every parent directory is traversable by Nginx, and that the target file is readable. A link can be present while its target is missing or outside the permissions granted to the serving account.

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

Choose a deployment layout that matches your operations

Decision Advantages Costs and cautions
Single release directory Simple paths and fewer moving parts. A deployment can interrupt requests, and rollback is less immediate.
Release-based directories with a current symlink Atomic switchovers and quick rollback. Shared storage, persistent uploads, environment files, and writable cache handling require explicit design.
POSIX groups Portable, easy to inspect, and familiar to Linux administrators. All cooperating users share the group’s effective permissions.
ACLs Fine-grained access for multiple service accounts. Harder to audit and dependent on filesystem and operational knowledge.
Local disk for uploads Simple Laravel filesystem configuration and low request latency on one VPS. Data is tied to that server and needs a backup and persistence plan.
Object storage Better durability, horizontal scaling, and access from multiple application servers. Requires credentials, network access, lifecycle rules, and a different filesystem configuration.

Self-managed VPS or managed server setup

A self-managed VPS gives you direct control over Nginx, PHP-FPM pools, filesystem ownership, deployment users, and release layout. It also makes you responsible for updates, service supervision, backups, firewalling, and diagnosing permission drift.

Laravel identifies Forge as a VPS server-management platform that can install and manage Nginx, MySQL, Redis, Memcached, Beanstalk, and related services. A managed setup can standardize those tasks, while a manually configured VPS may be preferable when you need custom operating-system policies, unusual pool isolation, or your own deployment tooling. Regardless of the management layer, the Laravel runtime rule remains the same: expose public/ and make storage/ plus bootstrap/cache/ writable by the process that serves requests.

Final verification checklist

  • Nginx root ends in /public.
  • Requests are routed through public/index.php with try_files.
  • The PHP-FPM socket and SCRIPT_FILENAME match the installed PHP service.
  • Dotfiles and the project root are not downloadable.
  • The verified PHP-FPM account can read the release tree.
  • Only storage/ and bootstrap/cache/ are runtime-writable.
  • public/storage exists when public uploads are enabled.
  • Configuration and deployment caches were built after the correct .env was installed.
  • A write test performed as the runtime account succeeds.
  • Logs, backups, and persistent upload storage are outside disposable release content.

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.