我想在Nginx + HVVM上运行Wordpress。 它在Apache + PHP上运行良好,但是当我激活Nginx时,网站中的大多数url都被重写为https。
这是我的网站configuration:
server { root /var/www/claremacdonald.co.uk; index index.php index.html index.htm; server_name *.claremacdonald.co.uk; include hhvm.conf; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } }
hhvm.conf:
location ~ \.(hh|php)$ { fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
/etc/hhvm/server.ini
; php options pid = /var/run/hhvm/pid ; hhvm specific hhvm.server.port = 9000 hhvm.server.type = fastcgi hhvm.server.default_document = index.php hhvm.log.use_log_file = true hhvm.log.file = /var/log/hhvm/error.log hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
/etc/hhvm/php.ini
; php options session.save_handler = files session.save_path = /var/lib/php5 session.gc_maxlifetime = 1440 ; hhvm specific hhvm.log.level = Warning hhvm.log.always_log_unhandled_exceptions = true hhvm.log.runtime_error_reporting_level = 8191 hhvm.mysql.typed_results = false hhvm.mysql.socket = /var/run/mysqld/mysqld.sock
网页源代码中的所有url都以https://的forms输出,但这仅仅是错误的:网站没有https版本。
我不知道在哪里看。 日志中没有错误,无论是Nginx还是HHVM。 configuration看起来对我好。
编辑:
我现在有端口8080上运行的nginx + HHVM进行testing,同样的事情发生,只有更糟的。 如果我去http://www.claremacdonald.co.uk:8080 ,我被redirect到https://www.claremacdonald.co.uk ,这是不存在的。
这是来自curl -v http://www.claremacdonald.co.uk:8080的输出
* Rebuilt URL to: http://www.claremacdonald.co.uk:8080/ * Trying 78.47.105.5... * Connected to www.claremacdonald.co.uk (78.47.105.5) port 8080 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.41.0 > Host: www.claremacdonald.co.uk:8080 > Accept: */* > < HTTP/1.1 301 Moved Permanently < Server: nginx/1.2.1 < Date: Mon, 23 Mar 2015 09:35:43 GMT < Content-Type: text/html; charset=UTF-8 < Transfer-Encoding: chunked < Connection: keep-alive < Set-Cookie: PHPSESSID=**********************; path=/ < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 < X-Pingback: https://www.claremacdonald.co.uk/xmlrpc.php < X-Powered-By: HHVM/3.6.0 < Pragma: no-cache < Location: https://www.claremacdonald.co.uk/ < * Connection #0 to host www.claremacdonald.co.uk left intact
显然nginxredirect到https与301,但我不能看到它configuration在任何地方。
当我configuration我的VirtualHosts时,曾经发生过这种情况,您的浏览器(Firefox肯定会)会保存网站偏好设置。 如果您曾经使用https加载该网站,则将其保存并在加载后继续使用https加载。 使用CTRL + SHIFT + DEL清除网站caching和首选项,以及是否有帮助