wordpress服务器部署nginx
时间: 2023-11-21 12:58:05 浏览: 108
以下是在WordPress服务器上部署Nginx的步骤:
1.安装Nginx
```
sudo apt-get update
sudo apt-get install nginx
```
2.配置Nginx
```
sudo rm /etc/nginx/sites-enabled/default
sudo vim /etc/nginx/sites-available/wordpress
```
在文件中添加以下内容:
```
server {
listen 80;
server_name your_domain.com;
root /var/www/wordpress;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
```
3.启用站点
```
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
```
4.重新启动Nginx
```
sudo service nginx restart
```
现在,您的WordPress网站应该已经成功地部署在Nginx上了。
阅读全文