1

I just tried to apache+reverse proxy nginx combo on clean Debian9 VMBox.
What i'd installed:

apt-get install apache2 php7.0 php7.0-cli php7.0-curl php7.0-fpm \
php7.0-mysql apache2 mysql-server mysql-client libapache2-mod-rpaf phpmyadmin \
build-essential apache2-dev \

After apache mods:

a2dismod mpm_event
a2enmod mpm_worker
a2enmod proxy_fcgi

After create config for site:

nano /etc/apache2/sites-avaible/localforum.conf

with:

<VirtualHost 127.0.0.1:81>
  ServerName localforum
  ServerAlias www.localforum

  ServerAdmin admin@localforum
  DocumentRoot /var/www/localforum/html

  ErrorLog ${APACHE_LOG_DIR}/domain_error.log
  CustomLog ${APACHE_LOG_DIR}/domain_access.log vhost_combined

  ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php7.0- fpm.sock|fcgi://127.0.0.1:81/var/www/localforum/html"
</VirtualHost>

After i'd created /var/www/localforum/html/index.php with:

<? phpinfo(); ?>

After i'd edited nginx.conf:

server {
    listen 80 default;
    server_name 192.168.0.140;

    include /etc/nginx/default.d/*.conf;

    location / {
        root /var/www/html;
        proxy_pass http://127.0.0.1:81/;
        proxy_redirect off;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    error_page 404 /404.html;
        location = /40x.html {
    }
}

and /etc/nginx/default.d/proxy.conf;

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

Start services

service apache2 start
service nginx start

But when i tried to get index.php i got empty page.
After i create simple html page and this works fine.

What can i miss with PHP?

1 Answer 1

2

Is the page really empty? What do the logs say?

On a hunch, I saw you used the deprecated short tag form <?.

Try using the full form <?php instead:

<?php
    phpinfo();
?>
1
  • Oh Lord. How can i miss this php.
    – Kliver Max
    Commented Jul 6, 2019 at 17:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .