# nginx配置php示例
# 定义一个server块,监听80端口
server {
listen 80;
server_name yourdomain.com; # 替换为你的域名
# 设置网站根目录
root /var/www/html;
index index.php index.html index.htm;
# 配置PHP处理
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # 根据你的PHP版本修改
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# 禁止访问隐藏文件(如 .htaccess, .git)
location ~ /\. {
deny all;
}
}
index.php、index.html 和 index.htm。.php 结尾的文件,并将其交给 PHP-FPM 处理。.htaccess、.git 等)。上一篇:php 生成随机字符串
下一篇:php str_split
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站