【发布时间】:2019-03-30 05:52:28
【问题描述】:
我正在尝试将另一个域链接到我现有的项目
我正在使用 Laravel 5.1,我知道我们在 .env 中只有一个 APP_URL。
有没有办法通过 Nginx 级别?
cat /etc/nginx/sites-available/default
server {
listen 80 default_server;
server_name default;
root /home/forge/bheng/public;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/default-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
如何配置这样的东西?
【问题讨论】:
-
值得注意的是,
APP_URL环境变量仅由 Laravel 用于未提供Host:请求标头的情况,例如来自控制台命令或使用类似route()的排队作业或asset()(在 HTTP 请求期间未启动)。
标签: laravel nginx virtualhost digital-ocean