|
1 | | -# Other webservers |
2 | | - |
3 | | -## NGINX |
4 | | - |
5 | | -**This is just an example, we assume that you have prior experience setting up NGINX Vhosts!** |
6 | | - |
7 | | -<br> |
8 | | - |
9 | | -[For further instructions, please refer to the official NGINX documentation provided by Laravel.](https://laravel.com/docs/9.x/deployment#nginx) |
10 | | - |
11 | | -<br> |
12 | | - |
13 | | -**To ensure proper security, access to certain configuration files must be prevented.** |
14 | | - |
15 | | -Example configuration: |
16 | | - |
17 | | -``` |
18 | | -server { |
19 | | - listen 80; |
20 | | - listen [::]:80; |
21 | | - server_name example.com; |
22 | | - root /path/to/example.com; |
23 | | - |
24 | | - add_header X-Frame-Options "SAMEORIGIN"; |
25 | | - add_header X-Content-Type-Options "nosniff"; |
26 | | - |
27 | | - index index.php; |
28 | | - |
29 | | - charset utf-8; |
30 | | - |
31 | | - location / { |
32 | | - try_files $uri $uri/ /index.php?$query_string; |
33 | | - } |
34 | | - |
35 | | - location = /favicon.ico { access_log off; log_not_found off; } |
36 | | - location = /robots.txt { access_log off; log_not_found off; } |
37 | | - |
38 | | - error_page 404 /index.php; |
39 | | - |
40 | | - location ~ \.php$ { |
41 | | - fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; |
42 | | - fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; |
43 | | - include fastcgi_params; |
44 | | - } |
45 | | - |
46 | | - location ~ /\.(?!well-known).* { |
47 | | - deny all; |
48 | | - } |
49 | | - |
50 | | -
|
51 | | -location ~ ^\. { |
52 | | -deny all; |
53 | | -} |
54 | | -
|
55 | | -location ~ \.sqlite$ { |
56 | | -deny all; |
57 | | -} |
58 | | -
|
59 | | -location ~ \.env$ { |
60 | | -deny all; |
61 | | -} |
62 | | -
|
63 | | -location ~ /\.htaccess { |
64 | | -allow all; |
65 | | -} |
66 | | - |
67 | | -} |
68 | | -``` |
69 | | - |
70 | | -## Apache2 |
71 | | - |
72 | | -**This is just an example, we assume that you have prior experience setting up Apache Vhosts!** |
73 | | - |
74 | | -**Access to configuration files is already denied via `.htaccess` files in the LinkStack root directory.** |
75 | | - |
76 | | -<br> |
77 | | - |
78 | | -```xml |
79 | | -<VirtualHost *:80> |
80 | | - ServerName example.com |
81 | | - ServerAlias www.example.com |
82 | | - ServerAdmin webmaster@localhost |
83 | | - DocumentRoot /path/to/example.com |
84 | | - DirectoryIndex index.htm index.html index.php |
85 | | - ErrorLog /var/log/httpd/linkstack/error.log |
86 | | - CustomLog /var/log/httpd/linkstack/access.log combined |
87 | | - |
88 | | - <Directory /> |
89 | | - Options FollowSymLinks |
90 | | - AllowOverride None |
91 | | - </Directory> |
92 | | - |
93 | | - <Directory /path/to/example.com/> |
94 | | - Options -Indexes +MultiViews +FollowSymLinks +ExecCGI |
95 | | - Require all granted |
96 | | - AllowOverride all |
97 | | - </Directory> |
98 | | -</VirtualHost> |
99 | | -``` |
100 | | -## Litespeed |
101 | | - |
102 | | -**This is just an .htaccess example, we assume that you have prior experience setting up Litespeed - Cyberpanel!** |
103 | | - |
104 | | -``` |
105 | | -<IfModule mod_rewrite.c> |
106 | | - <IfModule mod_negotiation.c> |
107 | | - Options -MultiViews |
108 | | - </IfModule> |
109 | | -
|
110 | | - RewriteEngine On |
111 | | -
|
112 | | - # Redirect Trailing Slashes If Not A Folder... |
113 | | - RewriteCond %{REQUEST_FILENAME} !-d |
114 | | - RewriteRule ^(.*)/$ /$1 [L,R=301] |
115 | | -
|
116 | | - # Handle Front Controller... |
117 | | - RewriteCond %{REQUEST_FILENAME} !-d |
118 | | - RewriteCond %{REQUEST_FILENAME} !-f |
119 | | - RewriteRule ^ index.php [L] |
120 | | -
|
121 | | - # Handle Authorization Header |
122 | | - RewriteCond %{HTTP:Authorization} . |
123 | | - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] |
124 | | -</IfModule> |
125 | | -
|
126 | | -# Restrict access to critical files |
127 | | -<FilesMatch "^\."> |
128 | | -Order allow,deny |
129 | | -Deny from all |
130 | | -</FilesMatch> |
131 | | -<Files ~ "\.sqlite$"> |
132 | | - Order allow,deny |
133 | | - Deny from all |
134 | | -</Files> |
135 | | -<Files ~ "\.zip$"> |
136 | | - Order allow,deny |
137 | | - Deny from all |
138 | | -</Files> |
139 | | -``` |
140 | | - |
141 | | -## More webservers |
142 | | - |
143 | | -Currently, no documentation is provided for other web server solutions. |
144 | | - |
145 | | -Please refer to the Laravel documentation regarding the setup process for your specific web server solution. |
| 1 | +# Other webservers |
| 2 | + |
| 3 | +## NGINX |
| 4 | + |
| 5 | +**This is just an example, we assume that you have prior experience setting up NGINX Vhosts!** |
| 6 | + |
| 7 | +<br> |
| 8 | + |
| 9 | +[For further instructions, please refer to the official NGINX documentation provided by Laravel.](https://laravel.com/docs/9.x/deployment#nginx) |
| 10 | + |
| 11 | +<br> |
| 12 | + |
| 13 | +**To ensure proper security, access to certain configuration files must be prevented.** |
| 14 | + |
| 15 | +Example configuration: |
| 16 | + |
| 17 | +``` |
| 18 | +server { |
| 19 | + listen 80; |
| 20 | + listen [::]:80; |
| 21 | + server_name example.com; |
| 22 | + root /path/to/example.com; |
| 23 | + |
| 24 | + add_header X-Frame-Options "SAMEORIGIN"; |
| 25 | + add_header X-Content-Type-Options "nosniff"; |
| 26 | + |
| 27 | + index index.php; |
| 28 | + |
| 29 | + charset utf-8; |
| 30 | + |
| 31 | + location / { |
| 32 | + try_files $uri $uri/ /index.php?$query_string; |
| 33 | + } |
| 34 | + |
| 35 | + location = /favicon.ico { access_log off; log_not_found off; } |
| 36 | + location = /robots.txt { access_log off; log_not_found off; } |
| 37 | + |
| 38 | + error_page 404 /index.php; |
| 39 | + |
| 40 | + location ~ \.php$ { |
| 41 | + fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; |
| 42 | + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; |
| 43 | + include fastcgi_params; |
| 44 | + } |
| 45 | + |
| 46 | + location ~ /\.(?!well-known).* { |
| 47 | + deny all; |
| 48 | + } |
| 49 | + |
| 50 | +
|
| 51 | +location ~ ^\. { |
| 52 | +deny all; |
| 53 | +} |
| 54 | +
|
| 55 | +location ~ \.sqlite$ { |
| 56 | +deny all; |
| 57 | +} |
| 58 | +
|
| 59 | +location ~ \.env$ { |
| 60 | +deny all; |
| 61 | +} |
| 62 | +
|
| 63 | +location ~ /\.htaccess { |
| 64 | +allow all; |
| 65 | +} |
| 66 | + |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +## Apache2 |
| 71 | + |
| 72 | +**This is just an example, we assume that you have prior experience setting up Apache Vhosts!** |
| 73 | + |
| 74 | +**Access to configuration files is already denied via `.htaccess` files in the LinkStack root directory.** |
| 75 | + |
| 76 | +<br> |
| 77 | + |
| 78 | +```xml |
| 79 | +<VirtualHost *:80> |
| 80 | + ServerName example.com |
| 81 | + ServerAlias www.example.com |
| 82 | + ServerAdmin webmaster@localhost |
| 83 | + DocumentRoot /path/to/example.com |
| 84 | + DirectoryIndex index.htm index.html index.php |
| 85 | + ErrorLog /var/log/httpd/linkstack/error.log |
| 86 | + CustomLog /var/log/httpd/linkstack/access.log combined |
| 87 | + |
| 88 | + <Directory /> |
| 89 | + Options FollowSymLinks |
| 90 | + AllowOverride None |
| 91 | + </Directory> |
| 92 | + |
| 93 | + <Directory /path/to/example.com/> |
| 94 | + Options -Indexes +MultiViews +FollowSymLinks +ExecCGI |
| 95 | + Require all granted |
| 96 | + AllowOverride all |
| 97 | + </Directory> |
| 98 | +</VirtualHost> |
| 99 | +``` |
| 100 | +## Litespeed |
| 101 | + |
| 102 | +**This is just an .htaccess example, we assume that you have prior experience setting up Litespeed - Cyberpanel!** |
| 103 | + |
| 104 | +``` |
| 105 | +<IfModule mod_rewrite.c> |
| 106 | + <IfModule mod_negotiation.c> |
| 107 | + Options -MultiViews |
| 108 | + </IfModule> |
| 109 | +
|
| 110 | + RewriteEngine On |
| 111 | +
|
| 112 | + # Redirect Trailing Slashes If Not A Folder... |
| 113 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 114 | + RewriteRule ^(.*)/$ /$1 [L,R=301] |
| 115 | +
|
| 116 | + # Handle Front Controller... |
| 117 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 118 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 119 | + RewriteRule ^ index.php [L] |
| 120 | +
|
| 121 | + # Handle Authorization Header |
| 122 | + RewriteCond %{HTTP:Authorization} . |
| 123 | + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] |
| 124 | +</IfModule> |
| 125 | +
|
| 126 | +# Restrict access to critical files |
| 127 | +<FilesMatch "^\."> |
| 128 | +Order allow,deny |
| 129 | +Deny from all |
| 130 | +</FilesMatch> |
| 131 | +<Files ~ "\.sqlite$"> |
| 132 | + Order allow,deny |
| 133 | + Deny from all |
| 134 | +</Files> |
| 135 | +<Files ~ "\.zip$"> |
| 136 | + Order allow,deny |
| 137 | + Deny from all |
| 138 | +</Files> |
| 139 | +``` |
| 140 | + |
| 141 | +## More webservers |
| 142 | + |
| 143 | +Currently, no documentation is provided for other web server solutions. |
| 144 | + |
| 145 | +Please refer to the Laravel documentation regarding the setup process for your specific web server solution. |
0 commit comments