Symlink Apps¶
Symbolic link (aka "symlink") applications are used to serve web content from a directory other than the root directory of an application. They work by creating a symlink pointing the desired directory.
Symlink apps are available in two varieties:
- PHP-FPM Symlink applications can serve PHP scripts (via CGI), CGI scripts, and static content via Opalstack's shared PHP-FPM service behind either Nginx or Apache.
- Static Symlink applications can serve static content directly from the front-end Nginx server.
Installing a symlink app¶
To install a symlink application:
-
Follow our general instructions for adding applications and select whichever symlink app type as the application type in step 5. A "Symbolic Link Path" field will appear in the application form when you've selected a symlink app type.
-
In the Symbolic Link Path field, enter the full path to the directory that you want to serve, including the trailing slash.
For example, if your shell user is named
myuserand you want to serve a directory namedmyfilesin the shell user's home directory, then you would enter/home/myuser/myfiles/as the symlink path. -
Click the green "Create Application" button to save your new symlink app.
-
Complete the setup by adding the symlink app to a site.
Example: serving a Laravel project with a symlink app¶
Modern PHP web frameworks such as Laravel typically serve their content from a subdirectory of the project directory. PHP apps on Opalstack are served from the app directory, so a symlink app is needed instead of a regular PHP application.
-
Create a shell user if you have not done so already. You can use an existing shell user if you wish.
The rest of this example will use
myuseras the shell user name. -
Upload your Laravel project into your shell user's home directory.
The rest of this example will use
mysiteas the Laravel project name. -
Create a new symlink application with the following values:
- Name: whatever you like. For this example we'll use
mysite_public_symlink - Type: PHP-FPM Nginx Symlink
- Symbolic Link Path:
/home/myuser/mysite/public/(changemyuserandmysiteto your shell user and project names.
- Name: whatever you like. For this example we'll use
-
Create a site to serve the symlink app from step 3 on the URI path
/.
