环境:nginx+centos7+php7+mysql
目的:准备开启facebook第三方登陆,发现提示必须开启伪静态。
自己的配置:
后台自定义路由配置为:
/question/(:any)===/q_(:any).html
/article/(:any)===/a_(:any).html
/topic/(:any)===/t_(:any).html
/people/(:any)===/p_(:any).html
/account/login/===/login/
/account/logout/===/logout/
/account/setting/(:any)/===/setting/(:any)/
nginx.conf 文件配置为:
server {
listen 443 ssl http2;
server_name www.mydomainname.com;
charset utf-8;
ssl on;
default_type text/plain;
ssl_certificate 1_www.mydomainname.com_bundle.crt;
ssl_certificate_key 2_www.mydomainname.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm index.php;
if (!-e $request_filename)
{
rewrite (.*) /index.php;
}
}
location ~ /phpmyadmin/.+\.php$ {
if ($fastcgi_script_name ~ /phpmyadmin/(.+\.php.*)$) {
set $valid_fastcgi_script_name $1;
}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$valid_fastcgi_script_name;
}
location ~ \.php$ {
# 设置监听端口
fastcgi_pass 127.0.0.1:9000;
# 设置nginx的默认首页文件(上面已经设置过了,可以删除)
fastcgi_index index.php;
# 设置脚本文件请求的路径
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# 引入fastcgi的配置文件
include fastcgi_params;
}
}
location / { } 里面这样写正确吗?
错误:除了首页可以打开外,如果打开每个问题、话题和文章的链接,都会是404 not found的提示。首
阅读全文
收起全文