阿里云 nginx+php+wordpress 403错误

按照网上的方法更改文件权限,添加.htaccess文件后都没有作用,访问博客页面仍然报403错误,此时打开/etc/nginx/sites-enabled/default文件,发现

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;

这两行,其中index.php是自己添加的,问题顺利解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是部署 MySQLNginx + PHP、并配置 WordPress 的项目步骤: 1. 部署 MySQL (1)安装 MySQL:在 Linux 系统上使用以下命令安装 MySQL: ``` sudo apt update sudo apt install mysql-server ``` (2)启动 MySQL:安装完成后,使用以下命令启动 MySQL: ``` sudo systemctl start mysql ``` (3)设置 MySQL 用户和密码:默认情况下,MySQL 服务器安装并未设置 root 密码,可以使用以下命令设置密码: ``` sudo mysql_secure_installation ``` 在该命令中,根据提示输入密码并进行其他设置。 2. 部署 Nginx + PHP (1)安装 Nginx:使用以下命令在 Linux 系统上安装 Nginx: ``` sudo apt-get update sudo apt-get install nginx ``` (2)安装 PHP:在 Linux 系统上使用以下命令安装 PHP: ``` sudo apt-get install php-fpm php-mysql ``` (3)配置 Nginx:使用以下命令打开默认 Nginx 配置文件: ``` sudo nano /etc/nginx/sites-available/default ``` 在该文件中,找到以下行: ``` index index.html index.htm index.nginx-debian.html; ``` 修改为: ``` index index.php index.html index.htm index.nginx-debian.html; ``` 然后,找到以下行: ``` # pass PHP scripts to FastCGI server # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): # fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # # With php-cgi (or other tcp sockets): # # fastcgi_pass 127.0.0.1:9000; #} ``` 将其修改为: ``` # pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; } ``` (4)重启 Nginx:使用以下命令重启 Nginx: ``` sudo systemctl restart nginx ``` 3. 配置 WordPress (1)下载 WordPress:从 WordPress 官方网站下载最新版本的 WordPress 并解压缩到 /var/www/html 目录下。 (2)修改权限:使用以下命令修改 WordPress 文件夹的权限: ``` sudo chown -R www-data:www-data /var/www/html/wordpress sudo chmod -R 755 /var/www/html/wordpress ``` (3)创建 MySQL 数据库和用户:使用 MySQL 命令行创建新的数据库和用户: ``` sudo mysql -u root -p CREATE DATABASE wordpress; CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost'; FLUSH PRIVILEGES; EXIT; ``` 在上面的命令中,将 password 替换为实际的密码。 (4)配置 WordPress:在浏览器中访问 http://your-server-ip-address/wordpress 并按照提示进行 WordPress 的配置。在配置数据库时,使用步骤 3 中创建的数据库和用户信息。 希望这些步骤对您有所帮助,如果您有任何疑问,请随时提出。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值