Welcome! Log In Create A New Profile

Advanced

Nginx and my public ip partially work

Posted by kizery 
Nginx and my public ip partially work
June 08, 2020 12:35PM
Hello evryone,
I run Nginx on a raspberry pi 3 with a wordpress site

When I launch my site with my public ip adresse (that I forwarded in my router to the raspberry local ip with port 80) is ok, the site is launched but...

css and others things are not loaded because the ip adress used is still the local adresse instead of the public one

For example, in the browser console I see

"http://192.168.1.2/wp-content/themes/radiate/style.css?ver=5.4.1"
But it should be "http://my-public-ip-adress/wp-content/themes/radiate/style.css?ver=5.4.1"
So the css file is not loaded

Here are my settings

wp-config:
define('WP_HOME','http://my-public-ip-adress');
define('WP_SITEURL','my-public-ip-adress');
-------------------------------------------------------------------

/etc/nginx/sites-available/wordpress:
upstream php-wp {
server unix:/var/run/wordpress.sock;
}
server {
listen 80;
listen [::]:80;
root /var/www/html/wordpress;
index index.php;
server_name 192.168.1.2 http://my-public-ip-adress;
access_log /var/log/nginx/http://my-public-ip-adress.access_log;
error_log /var/log/nginx/http://my-public-ip-adress.error_log
notice;
# location ~ \.php$
#{
# include snippets/fastcgi-php.conf;
#fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
#}

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

location = /favicon.ico {
log_not_found off;
access_log off;
}


location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ .php$ {
include fastcgi.conf;
fastcgi_pass php-wp;
}


location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}

}
-------------------------------------------------------------------

/etc/php/7.3/fpm/pool.d/wordpress.conf:
[wordpress]
listen = /var/run/wordpress.sock
listen.owner = pi
listen.group = www-data
user = pi
group = www-data
pm = ondemand
pm.max_children = 92
pm.process_idle_timeout = 60s
pm.max_requests = 500
-------------------------------------------------------------------


of course, when I run the wordpress locally, everythings is fine

someone could help me with that ?
Re: Nginx and my public ip partially work
June 08, 2020 10:30PM
I add in attachment a screenshot of my problem
Attachments:
open | download - 09-06-2020 04-26-23.png (51.8 KB)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready