存放所有可用的虚拟主机配置文件。 在这里编写和修改配置,但此时配置不会直接生效。
存放实际启用的虚拟主机配置文件的符号链接(软链接)。
Nginx 的主配置文件(nginx.conf)会通过 include /etc/nginx/sites-enabled/*; 引入这里的配置。
只有在这个目录下的配置,才会被 Nginx 实际加载和运行。
server { listen 80; server_name yourdomain.com; # 替换为你的域名或IP
location / { #本地解析
root /var/www/your_site; # 替换为你的网站根目录、
index index.php index.html index.htm;#索引
try_files $uri $uri/ =404;
}
location ~ \.php$ { #php解析
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock; # 根据实际PHP版本调整
}
}