PHP not parsed while accessing IPv6 on ip in browser [nginx+apache]

DigiWorks

Verified User
Joined
Dec 19, 2018
Messages
23
Location
NL
Hello,

After installing a new server (with nginx + apache) and checking if IPv6 works i just noticed something weird.
in the /var/www/html/ we have placed a index.php that displayed the name of the requested domain.

If lookup the website via hostname there is no problem. But if i request it based on ip like https://[2a0b:xxx:xxx::xxx]/ it will not parse the PHP code and instead of displaying the page it will be downloaded (via octet-stream). The problem does not occur if we use only apache as a webserver.

Are there any other users that have nginx + apache that have this issue?

Regards,
Erik
 

Attachments

  • ipv6_stream.PNG
    ipv6_stream.PNG
    14.4 KB · Views: 163
did you link IPV6 to IPV4 ? if not, try link it and see result.
 
Just test it with CURL
Code:
curl -k -6 https://[IPv6 Address]/redirect.php
Results in this output:

<?php
header("Location: http://".$_SERVER['HTTP_HOST'].":2222");
?>


Via hostname
curl -k -6 https://<hostname>/redirect.php
Does the normal redirect

Via IPv4 there are no issues
 
ok.
Could you confirm, you have check option, "Add to Apache" in IP Links ?
Could you confirm, "/webmail" or "/phpmyadmin" work fine ? if not, there have a little bug about order config file.

PHP doesn't work /var/www/html/, it only work with "/roundcube" or "/phpmyadmin", that have directly config proxy.

this workaround.
Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/nginx_reverse/conf
cp configure/nginx_reverse/conf/nginx.conf custom/nginx_reverse/conf/nginx.conf

and edit "custom/nginx_reverse/conf/nginx.conf" to something like this
Code:
#user  nginx;

worker_processes  auto;
pid /var/run/nginx.pid;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

events {
    include /etc/nginx/nginx-events.conf;
}


http {
    include       /etc/nginx/mime.types;

    # For user configurations not maintained by DirectAdmin. Empty by default.
    include /etc/nginx/nginx-includes.conf;

    # Supplemental configuration
    include /etc/nginx/nginx-fastcgi-cache.conf;
    include /etc/nginx/nginx-cloudflare.conf;
    include /etc/nginx/nginx-modsecurity-enable.conf;
    include /etc/nginx/nginx-defaults.conf;
    include /etc/nginx/nginx-gzip.conf;
    include /etc/nginx/nginx-proxy.conf;
    #include /etc/nginx/directadmin-ips.conf; #MOVE TO UNDER
    include /etc/nginx/directadmin-settings.conf;
    include /etc/nginx/nginx-vhosts.conf;
    include /etc/nginx/directadmin-ips.conf;
    include /etc/nginx/directadmin-vhosts.conf;
}
save and rewrite_confs
Code:
./build rewrite_confs

you can see, config will loaded only from "directadmin-ips.conf;" that have first order before "nginx-vhosts.conf"
I move line "include /etc/nginx/directadmin-ips.conf;" to under "include /etc/nginx/nginx-vhosts.conf;"

In the past I have problem with /roundcube or /phpmyadmin that doesn't load statics file. so I debug issued and see something like this.


#/etc/nginx/nginx-vhosts.conf;
Contain virtualhost with IPs(Link) that have proxy settings to apache.

#/etc/nginx/directadmin-ips.conf;
Only have raw nginx and non-php serve, that doesn't work well with nginx_apache

I don't know, why DA generate 2 files that "nginx-vhosts.conf" should cover everything for nginx_apache, but "
directadmin-ips.conf" conflic with nginx_apache
 
ok.
Could you confirm, you have check option, "Add to Apache" in IP Links ?
Yes, i have checked that option
Could you confirm, "/webmail" or "/phpmyadmin" work fine ? if not, there have a little bug about order config file.
That's correct. All aliases work fine.
PHP doesn't work /var/www/html/, it only work with "/roundcube" or "/phpmyadmin", that have directly config proxy.
As on above yes, on /var/www/html PHP doesn't work and roundcube and phpmyadmin works fine.

Thanks for the workaround. I will try it tomorrow and i will post the results here. I hope this will be fixed in the future updates.
 
Back
Top