如何设置Laravel Forge / nginx默认站点



我有一个nginx服务器,只有一个网站,由Laravel Forge管理。 目前,它响应单个子域的请求:subdomain_a.mydomain.com.au。 我需要它来响应对subdomain_b.mydomain.com.au以及原始IP地址的请求。 我该怎么做?

这是nginx配置:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/subdomain_a.mydomain.com.au/before/*;
server {
listen 80;
listen [::]:80;
server_name subdomain_a.mydomain.com.au;
root /home/forge/subdomain_a.mydomain.com.au/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-(truncated by me!!!);
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/subdomain_a.mydomain.com.au/server/*;
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/subdomain_a.mydomain.com.au-error.log error;
error_page 404 /index.php;
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/subdomain_a.mydomain.com.au/after/*;

我是nginx和Forge的新手,这将在几天内投入生产。

在锻造中打开您的网站页面,在右下角有一个名为"文件"的下拉菜单,单击"编辑Nginx配置"。

现在,您必须将此指令(如此处所述(从:

add_header X-Frame-Options "SAMEORIGIN";

add_header X-Frame-Options "allow from https://your-ip-or-domain.tld"

最新更新