新建了一个虚拟主机,虚拟主机的配置文件如下,网址替换了,怕怕
求访问xxx.com自动跳转到https://xxx.com
同时访问xxx.com/1.php能自动跳转到https://xxx.com/1.php
感激不尽- server

  • {
  • listen 80;
  • server_name xxx.com;
  • index index.html index.htm index.php default.html default.htm default.php;
  • root /home/wwwroot/xxx.com;
  • - listen 443;
  • server_name www.xxx.com xxx.com;
  • index index.html index.htm index.php;
  • error_page 404 403 http://xxx.com;
  • ssl on;
  • ssl_certificate /root/vision_im.crt;
  • ssl_certificate_key /root/server.key;
  • - include wordpress.conf;
  • location ~ .*\.(php|php5)?$
  • {
  • fastcgi_pass unix:/tmp/php-cgi.sock;
  • fastcgi_index index.php;
  • include fcgi.conf;
  • }
  • - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  • {
  • expires 30d;
  • }
  • - location ~ .*\.(js|css)?$
  • {
  • expires 12h;
  • }
  • - log_format xxx.com '$remote_addr - $remote_user [$time_local] $request '
  • '$status $body_bytes_sent $http_referer '
  • '$http_user_agent $http_x_forwarded_for';
  • access_log /home/wwwlogs/xxx.com.log xxx.com;
  • }
  • 复制代码