webgaha
By:
webgaha

Virtual Host config for Nginx as Proxy

December 2, 2017 72 views
Nginx

I'm having a problem with Virtual Host on nginx as proxy for ubuntu. My website is been redirected from example.com to www.example.com/index.php
Also, my htaccess is not working. Someone could help me? Thanks.

server {
listen 80;
server_name test.io www.test.io;
root /var/www/test.io;
index index.php index.htm index.html;

location / {
    try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
    proxy_pass http://your_ip_address:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

location ~ /\. {
    deny all;
}

}

Be the first one to answer this question.