tp5在nginx下配置好https,可以用http方式访问模块,而https不可以

浏览:3274 发布日期:2018/03/07 分类:求助交流 关键字: https nginx tp5
如题,我原先是使用apache+php5.6的,tp5版本是5.0.12,最近切到win+nginx+php7.1的环境的,phpstudy。根据网上的资料,配置了https,根据阿里云的免费方式。配置后可以访问:http://www.lxxxx.com/pro,https://xxx.com也可以访问,能看到nginx的helloworld,而https://www.lxxxx.com/pro就出现了404报错。请大神指点下该怎么改。下面是conf配置:
server {
listen 80;

server_name localhost;

#charset koi8-r;
# charset utf-8;

#access_log logs/host.access.log main;
set $root "C:/myphp_www/PHPTutorial/WWW/xyxxx/public";

location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}

location / {
root $root;
index index.html index.php;
if ( -f $request_filename) {
break;
}
if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
}





}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

location ~ .+\.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

fastcgi_param script_FILENAME $root$fastcgi_script_name;
include fastcgi_params;
}







# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
# location ~ \.php(.*)$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
# fastcgi_param script_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
# include fastcgi_params;
# }

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
server {
listen 443 ssl;
server_name localhost;
# ssl on;
root html;
index index.html index.htm;
ssl_certificate cert/214504724xxxx.pem;
ssl_certificate_key cert/21450xxxx.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-xxx-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}

#
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

include vhosts.conf;

}

最佳答案
评论( 相关
后面还有条评论,点击查看>>