Loading... **步骤1:安装 Nginx 和 PHP** ```apache sudo apt update sudo apt install -y nginx php-fpm ``` **步骤2:创建网站目录** ```apache sudo mkdir -p /data/wwwroot sudo chown -R www-data:www-data /data/wwwroot ``` **步骤3:配置 Nginx(/etc/nginx/sites-available/huasan.com)** ```apache server { listen 80; server_name www.huasan.com; root /data/wwwroot; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.3-fpm.sock; } } ``` **步骤4:启用网站并检查配置** ```apache sudo ln -s /etc/nginx/sites-available/huasan.com /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx ``` **步骤5:创建 index.php 文件(/data/wwwroot/index.php)** ```apache <?php echo "This is website!"; ?> ``` **步骤6:重启 PHP-FPM** ```apache sudo systemctl restart php7.3-fpm ``` 最后修改:2023 年 07 月 20 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏