-
Notifications
You must be signed in to change notification settings - Fork 356
Closed
Labels
z-enhancement ⬆️Product EnhancementProduct Enhancement
Description
I'm trying to run wordpress behind unit following the documentation, but ran into an issue.
My wordpress site is distributed by NGINX using HTTPS, but Unit keep telling the PHP script that SERVER_PORT is 80. As Wordpress uses 'SERVER_PORT' to determine the actual URL scheme, it think the client tried to access the server using http instead of https, and send a 301 redirect to fix that.
As there is no way to specify SERVER variable in the configuration, I can't access my wordpress instance.
{
"listeners": {
"127.0.0.1:8090": {
"pass": "applications/wp_index"
},
"127.0.0.1:8091": {
"pass": "applications/wp_direct"
}
},
"applications": {
"wp_index": {
"type": "php",
"user": "www",
"group": "www-data",
"root": "/var/www/wordpress/",
"script": "index.php"
},
"wp_direct": {
"type": "php",
"user": "www",
"group": "www-data",
"root": "/var/www/wordpress/",
"index": "index.php"
}
}
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name wordpress.example.com;
root /var/www/wordpress;
ssl on;
ssl_certificate /var/lib/acme/wordpress/rsa/cert.pem;
ssl_certificate_key /var/lib/acme/wordpress/rsa/keys/key.pem;
ssl_certificate /var/lib/acme/wordpress/ecdsa/cert.pem;
ssl_certificate_key /var/lib/acme/wordpress/ecdsa/keys/key.pem;
ssl_dhparam /var/lib/acme/wordpress/params.pem;
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri @index_php;
}
location @index_php {
proxy_pass http://unit_wp_index;
proxy_set_header Host $host;
}
location /wp-admin {
index index.php;
}
location ~* \.php$ {
try_files $uri =404;
proxy_pass http://unit_wp_direct;
proxy_set_header Host $host;
}
}
oneumyvakin and ibakirov
Metadata
Metadata
Assignees
Labels
z-enhancement ⬆️Product EnhancementProduct Enhancement
Type
Projects
Status
🚀 Released