I am trying to run Wordpress on Nginx + HVVM. It runs fine on Apache + PHP, but when I activate Nginx, most of the urls in the website get rewritten to https.
Here is my website config:
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
All of the urls in the page source are output as https:// which is simply wrong: there is no https version of the site.
I'm not sure where to look. There are no errors in the logs, either of Nginx or HHVM. And the configuration looks ok to me.
EDIT:
I now have nginx + HHVM running on port 8080 to test, and the same thing is happening, only worse. If I go to http://www.claremacdonald.co.uk:8080, I get redirected to https://www.claremacdonald.co.uk, which does not exist.
This is the output from 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
Apparently nginx is redirecting me to https with a 301, but I can't see it configured anywhere.