我正在尝试将另一个域链接到我现有的项目
我使用的是 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;
}
}
如何配置这样的东西?
最佳答案
将两个域作为别名放在服务器名称配置中
server_name domain1.com www.domain1.com domain2.com www.domain2.com ;
关于laravel - 通过 Nginx 将 2 个域链接到 1 个 Laravel 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52992302/