描写的更清晰

修改理由:
此投稿已在 6年前 合并。
标签修改:
内容修改:
Old | New | Differences |
---|---|---|
1 | 配置需要注意安全和重写 | |
1 | # Nginx 配置 | |
2 | ||
3 | 如果你把应用程序部署到执行 `Nginx` 的服务器,你可以使用下面的配置内容来开始设置你的 `Web` 服务器。此配置内容最好根据你的服务器需求做一些自定义的修改。如果你需要托管你的服务器,可以考虑 [Laravel Forget](https://forge.laravel.com/) 等服务: | |
4 | ||
5 | ``` | |
6 | server { | |
7 | listen 80; | |
8 | server_name example.com; | |
9 | root /example.com/public; | |
10 | ||
11 | add_header X-Frame-Options "SAMEORIGIN"; | |
12 | add_header X-XSS-Protection "1; mode=block"; | |
13 | add_header X-Content-Type-Options "nosniff"; | |
14 | ||
15 | index index.html index.htm index.php; | |
16 | ||
17 | charset utf-8; | |
18 | ||
19 | location / { | |
20 | try_files $uri $uri/ /index.php?$query_string; | |
21 | } | |
22 | ||
23 | location = /favicon.ico { access_log off; log_not_found off; } | |
24 | location = /robots.txt { access_log off; log_not_found off; } | |
25 | ||
26 | error_page 404 /index.php; | |
27 | ||
28 | location ~ \.php$ { | |
29 | fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
30 | fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | |
31 | fastcgi_index index.php; | |
32 | include fastcgi_params; | |
33 | } | |
34 | ||
35 | location ~ /\.(?!well-known).* { | |
36 | deny all; | |
37 | } | |
38 | } | |
39 | ``` |