Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Nginx and my public ip partially work

$
0
0
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 ?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>