I'm trying to run apache and wordpress using reverse-proxy with nginx, but i'm having problem to access some pages of my wordpress. Normally i can acceed wp-admin page but when i try to view some page, the page domain come with multiple uri, like, localhost/wordpress/index.php/contact?q=wordpress/index.php/contato/&q=wordpress/index.php/contato/&q=wordpress/index.php/contato/&... and goes far away repeating this.
I'm trying to run locally a nginx server that supports wordpress on apache because I want to pass this configuration to my vps to make another website in nodejs without needing to specify ports on domain
this is my /etc/nginx/sites-enable/default code:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
#try_files $uri $uri/ =404;
#try_files $uri $uri/ /index.php?q=$uri&$args;
try_files $uri $uri/ /index.php?$args;
proxy_pass http://localhost:81;
#proxy_pass_reverse / http://localhost:81/
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;
#ProxyPreserveHost On;
#rewrite /wp-admin$ $scheme://$host$uri/index.php?q=$1 permanent;
#rewrite ^/(.*)$ $scheme://$host$uri/index.php?q=$1 permanent;
rewrite ^/(.*)$ /index.php?$1 ;
include /etc/nginx/proxy_params;
}
location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ {
expires 30d;
}
location @proxy {
proxy_pass http://127.0.0.1:81;
include /etc/nginx/proxy_params;
}
location ~* \.php$ {
proxy_pass http://127.0.0.1:81;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#include snippets/fastcgi-php.conf;
include /etc/nginx/proxy_params;
}
}
I'm expecting to fix this multiple domains.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.