Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

Laravel Folder Structure and Permissions for Deployment on a VPS

A practical Laravel VPS deployment guide covering the public document root, directory roles, PHP-FPM ownership, writable paths, storage links, cache commands, release layouts, and permission troubleshooting.
Length8 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a secure Laravel VPS deployment, point Nginx at the application’s public/ directory—not the project root—and give the PHP-FPM account write access only to storage/ and bootstrap/cache/. Keep .env, source code, dependencies, and other private directories outside the web root. This arrangement prevents configuration disclosure while allowing Laravel to log, cache, compile views, store sessions, and process uploads.

The exact Linux user, group, ACL, and numeric mode depend on your distribution and PHP-FPM pool. Verify those values on the server instead of applying a universal chmod 777 command.

As an Amazon Associate I earn from qualifying purchases.

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

How Laravel’s directories fit together

A Laravel release is more than a collection of web files. The framework’s front controller is in public/index.php, while application code, configuration, templates, routes, dependencies, and runtime data live beside it. Nginx should expose only the public directory; requests for dynamic pages are then passed to the front controller.

Directory Purpose Runtime write requirement
app/ Application classes and most domain code. Read-only for PHP-FPM in a normal deployment.
bootstrap/ Framework bootstrap files. The bootstrap/cache/ subdirectory must be writable for generated cache files.
config/ Configuration files loaded by the application. Read-only after deployment configuration is complete.
database/ Migrations, factories, and seeders. Read-only for the web process; migration commands run under a deployment or maintenance identity.
public/ Front controller and browser-facing assets. Usually read-only; deploy new assets through your release process.
resources/ Blade views and raw, uncompiled assets. Read-only at runtime.
routes/ HTTP, console, and other route definitions. Read-only at runtime.
storage/ Logs, compiled Blade templates, file sessions, file caches, and generated application files. Writable by the PHP-FPM or web-server account.
storage/app/public/ Files on the public disk that should be reachable through a URL. Writable when the application accepts uploads.
vendor/ Composer-installed dependencies. Read-only at runtime; update it during deployment.

Laravel divides storage/ into application data, framework-generated data, and logs. A request can therefore fail even when the application code is readable: writing a log entry, compiling a Blade view, creating a file session, or rebuilding a cache still requires directory permissions.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Why the Nginx root must be public/

Set the virtual host’s root to the absolute path ending in /public. If the root is the project directory, a misconfigured location can expose .env, source files, Composer metadata, or configuration. Secrets in .env can include database credentials, signing keys, and third-party tokens; they should never be downloadable by a browser.

A minimal server block follows Laravel’s documented front-controller pattern. Replace paths, the PHP-FPM socket, and the server name with values from your VPS:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
server {
    listen 80;
    server_name example.test;
    root /srv/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 ~ /. {
        deny all;
    }
}

The try_files directive serves an existing asset directly and sends other paths to public/index.php. SCRIPT_FILENAME must resolve to the actual PHP file, and fastcgi_pass must match the PHP-FPM version and pool installed on the server. A socket path copied from another distribution may silently point to nothing.

Check the effective document root

  1. Find the enabled Nginx site configuration and confirm its root ends in /public.
  2. Check that public/index.php exists under that path.
  3. Inspect the PHP-FPM service or pool configuration to identify its operating user and socket.
  4. Reload Nginx only after configuration syntax validation with your distribution’s Nginx test command.

Never solve a 404 or routing problem by changing the root to the project directory. Correct the try_files rule, the release path, or the PHP-FPM mapping instead.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Which paths need write permission?

Laravel’s deployment guidance specifically requires the web-server process owner to write to storage/ and bootstrap/cache/. Those are the two paths to design around. The runtime account normally needs read and execute access through the rest of the release tree so PHP can load classes, configuration, routes, and views, but it does not need broad write access to those files.

storage/

Grant write and directory traversal permission recursively where Laravel creates files. This includes logs, framework caches, compiled views, file-based sessions, and application-generated files. If the application stores uploads on the local public disk, include storage/app/public/ in the writable tree.

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

bootstrap/cache/

Laravel writes generated service, package, route, and configuration cache artifacts here. A deployment can appear healthy until an optimization command or a cache rebuild runs, then fail with “permission denied” because this directory is owned by a different account or lacks group write permission.

Everything else

Keep source, configuration, migrations, routes, resources, and Composer dependencies read-only to the runtime account where practical. The deployment identity can still write a new release, run Composer, build assets, and execute migrations. Separating those responsibilities limits the damage if a web process is compromised.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Build a least-privilege ownership model

First determine the effective PHP-FPM identity. Depending on the distribution and pool, it may be www-data, nginx, or a pool-specific user. Check the pool configuration rather than assuming a name. Also identify the account that performs deployments. A controlled deployment user plus a runtime group makes permissions predictable.

One common design is: the deployment user owns each release; the runtime account belongs to a shared application group; files are group-readable; and only storage/ and bootstrap/cache/ are group-writable. The exact numeric modes are a policy choice, not a Laravel requirement. Apply them to the target system after confirming its umask, service account, and release layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Ensure every parent directory in the path is executable (traversable) by the runtime account.
  • Make application files readable by PHP-FPM without making them writable.
  • Set group ownership on the two mutable directories and preserve it for newly created files.
  • Use POSIX ACLs when several deployment, queue, and web identities need different access levels.
  • Do not grant write access to the entire project merely because one subdirectory is failing.

POSIX groups are portable and easy to audit. ACLs provide finer control for multiple pools or workers, but they add another layer to inspect during troubleshooting. Whichever model you choose, document it with the release process so a new deployment does not reset ownership.

Why chmod -R 777 is the wrong fix

Mode 777 allows every local user and process to read, write, and enter the affected files and directories. It is substantially broader than Laravel’s documented requirement and can let an unrelated service alter application code, inject files, or replace generated data. It also hides the underlying ownership problem, so a later deployment may fail again.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Instead, identify the failing path from the exception, inspect ownership and mode with the server’s file-information tools, and grant write access to the PHP-FPM identity only where Laravel needs it. If a queue worker runs under a separate user, include that identity deliberately through a group or ACL rather than opening the whole tree.

Public uploads and the storage link

Files placed on Laravel’s public disk are stored under storage/app/public. They are not automatically reachable at a URL because that directory is outside Nginx’s document root. Run this command from the project directory when public access is intended:

php artisan storage:link

The command creates public/storage as a link to storage/app/public. Confirm that the link target exists, that Nginx can traverse each parent directory, and that the web server is configured to serve the resulting path. Do not use this mechanism for private documents; keep private files outside the public disk and deliver them through authorization-controlled application responses or a private storage service.

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

Release directories, shared paths, and rollback safety

A single mutable directory is simple, but a release-based layout is safer for rollback. A typical arrangement has immutable directories such as /srv/www/example/releases/20261015-1200, a current symlink, and shared writable paths for storage and the environment file. Point Nginx at current/public, then switch the symlink atomically after the new release passes checks.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

When using releases, do not let each deployment create an unrelated empty storage directory. Either share the existing storage path or provision it with the same ownership, group, and ACL policy before switching current. Keep .env outside the release archive or link it into the release with permissions that prevent web downloads. A rollback should restore code and cached artifacts consistently, not leave the previous release writing into a directory owned by the new release.

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

Cache and configuration steps after permissions are correct

Laravel reads environment values while building configuration. After configuration is cached, calls to env() outside configuration files return null; therefore, set and verify .env before creating the cache.

  1. Install dependencies and prepare the release as the deployment identity.
  2. Verify the runtime can read the release and write storage/ and bootstrap/cache/.
  3. Set the production environment values, including the application key and database connection.
  4. Run php artisan optimize, or run the individual config:cache, event:cache, route:cache, and view:cache commands appropriate to the application.
  5. Run php artisan storage:link when public uploads are part of the application.
  6. Switch the Nginx target or release symlink, then reload PHP-FPM and Nginx using the host’s service manager.

Run cache commands as an identity that can write the target directories. If a deployment user creates root-owned cache files, the web process may be unable to refresh them on the next request.

Diagnose common permission and routing failures

“Permission denied” in a log or cache operation

  • Read the complete path in the exception; distinguish storage from bootstrap/cache.
  • Check ownership, group, mode, and ACL entries for every parent directory.
  • Confirm the PHP-FPM user, not merely the SSH user, has the required access.
  • Check whether a deployment, cleanup job, or release switch recently recreated the directory with different ownership.
  • Fix the narrow path and preserve its group or ACL for future files.

Assets work but application routes return 404

Confirm Nginx uses .../public as its root and that the location block contains the front-controller try_files rule. Check that the requested route is defined and that PHP-FPM is reachable through the configured socket.

The application downloads .env or source files

Stop serving the project root immediately. Change the root to public/, deny dotfiles, review enabled server blocks, and invalidate any exposed credentials. A deny rule is useful defense in depth, but it does not replace the correct document root.

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

Uploads save successfully but return broken URLs

Verify the storage link, its target, URL configuration, and directory traversal permissions. A successful write to storage/app/public does not prove that Nginx can serve public/storage.

Deployment checklist

  • Nginx root is the absolute Laravel public/ directory.
  • Requests fall back to public/index.php through try_files.
  • PHP-FPM’s actual socket and process identity are verified.
  • Dotfiles and the project root are not publicly served.
  • The runtime can write storage/ and bootstrap/cache/, but not the rest of the release.
  • Public uploads use php artisan storage:link only when they are meant to be public.
  • .env and configuration are correct before cache commands run.
  • Deployment, queue, and web identities share only the permissions each requires.
  • PHP-FPM and Nginx are reloaded through the host’s service manager after a successful release.

Self-managed VPS or managed server setup?

A self-managed VPS gives you control over the operating system, PHP-FPM pools, filesystem layout, firewall, and deployment tooling, but you must maintain those components and audit permissions yourself. Laravel Forge is a server-management platform that can install and manage Nginx, PHP-related services, databases, Redis, Memcached, and Beanstalk. A managed setup can reduce initial configuration work; it does not remove the need to understand the application’s document root, writable directories, secrets, and release process. Whichever route you use, verify the resulting server rather than assuming a control panel’s defaults match your Laravel version or deployment layout.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.