title: Nginx as reverse proxy for Apache not working - serving static file
body: <p>I configured a vps server with nginx, php-fpm and apache on it.</p>
  
  <p><b>Usual web sites</b> with .html extension <b>are serverd</b> as static web pages like <b>normal</b>, but when I try to use .php page which dynamically generate content I see only pure html code like Nginx is serving .txt file.</p>
  
  <p>Nginx listens on 80, Apache on 8080. </p>
  
  <p>Mods disabled:
     <code>mod_proxy, mod_actions</code></p>
  
  <p>Nginx server block configuration:</p>
  
  <pre><code>server {
      server_name example.com www.example.com;
      listen 80;
      root /var/www/example.com;
      index index.php;
      location / {
          try_files $uri $uri/ /index.php;
      }
      location ~ \.php$ {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $remote_addr;
          proxy_set_header Host $host;
          proxy_pass http://IP:8080;
      }
  }
  </code></pre>
  
  <p>Apache virtual host configuration:</p>
  
  <pre><code>&lt;VirtualHost *:8080&gt;
      DocumentRoot /var/www/example.com
      ServerName example.com
      &lt;Directory /&gt;
          AllowOverride All
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Nginx &amp; Apache both work under %username%, using %username% as group too.</p>
  
  <p>Code seems to be correct, but the problem is when I load webpage example.com/index.php it is loaded like a .txt file with pure html code instead of normal .php page.</p>
  
  <p>Same with info.php with usual <code>"&lt;?php phpinfo(); ?&gt;"</code></p>
  
  <p><b>I see code but not real</b> info <b>page</b>.</p>