nginx 配置 phpmyadmin
时间: 2023-11-22 08:48:40 浏览: 74
nginx php配置
以下是在Nginx上配置phpMyAdmin的步骤:
1.安装phpMyAdmin和Nginx:
```
sudo apt update
sudo apt install phpmyadmin nginx
```
2.打开Nginx的默认站点配置文件:
```
sudo nano /etc/nginx/sites-available/default
```
3.在server块内添加以下内容:
```
location /phpmyadmin {
root /usr/share/;
index index.php;
try_files $uri $uri/ =404;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
```
4.保存并关闭文件,然后重新加载Nginx配置:
```
sudo systemctl reload nginx
```
现在,您应该能够通过访问http://your_server_ip/phpmyadmin来访问phpMyAdmin了。
阅读全文