所以我正在尝试在我的 Ubuntu 16.04 DO droplet 上设置一个 YOURLS URL 缩短器。我对 MySQL 和 PHP 很陌生,所以我不知道可能出了什么问题。我对 Nginx 非常满意,因为我一直在使用它,但似乎这些错误是由 MySQL 数据库和/或 PHP 配置引起的。
设置:
Nginx root(用于站点):(/var/www/bnbr.co/public_html
bnbr.co 是我将使用的域)
PHP 配置文件(位于/var/www/bnbr.co/public_html/config.php
)
php7.0-fpm 池(位于/etc/php/7.0/fpm/pool.d/username.conf
)
MySQL 设置:
MariaDB [(none)]> CREATE DATABASE yourls;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON yourls.* TO 'username'@'localhost' IDENTIFIED BY 'passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q
编辑:域的 Nginx 配置文件(位于/etc/nginx/sites-enabled/bnbr_co
)
# main
server {
listen 443;
server_name bnbr.co;
root /var/www/bnbr.co/public_html;
index index.php;
ssl on;
ssl_certificate /etc/letsencrypt/live/bnbr.co/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/bnbr.co/privkey.pem;
ssl_session_timeout 10m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /yourls-loader.php;
expires 14d;
add_header Cache-Control 'public';
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-username.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
}
# HTTP --> HTTPS REDIRS
# main
server {
listen 80;
server_name bnbr.co;
return 301 https://$server_name$request_uri;
} #`
我是这个东西的新手,所以我希望你们能提供帮助。
谢谢!