situation with friendly urls

Rick Gutierrez xserverlinux at gmail.com
Sun Apr 9 20:08:30 UTC 2023


El dom, 9 abr 2023 a las 7:27, Francis Daly (<francis at daoine.org>) escribió:
>

Hi Francis :)

>
> When you say that it does not load correctly, can you show one specific
> request that does not get the response that you want it to get? That
> should make it easier to identify where things are going wrong.

https://netsoluciones.com

This is the site, for example when I want to load the site in English
it doesn't do it, it doesn't load the images and css either.


> For what it is worth: the debug log that you show, does not appear to
> come from a system that is using the configuration that you show.

I think this is my mistake, I show you the backend config and then the
reverse proxy.

### backend config of nignx

location /

    {

      try_files $uri $uri/ /index.php?$args;

      root /var/www/sites/netsoluciones.com/htdocs;
       index index.php index.html index.htm;
    }

location /assets/ {

   alias /var/www/sites/netsoluciones.com/htdocs/assets/;

}

location /css/ {

   alias /var/www/sites/netsoluciones.com/htdocs/css/;

}

location /img/ {

   alias /var/www/sites/netsoluciones.com/htdocs/img/;

}

location /vendor/ {

   alias /var/www/sites/netsoluciones.com/htdocs/vendor/;

}

    # Scripts en PHP:

location ~ "\.php$" {

fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
       fastcgi_index  index.php;

#        fastcgi_pass 127.0.0.1:9000;


### REVERSE PROXY

upstream backend00 {

    server X.X.X.X:80;

    keepalive 2;

}

server {

    if ($host = www.netsoluciones.com) {

        return 301 https://$host$request_uri;

    } # managed by Certbot

    if ($host = netsoluciones.com) {

        return 301 https://$host$request_uri;

    } # managed by Certbot

listen 80;

        server_name www.netsoluciones.com netsoluciones.com; #YourIP
or domain
pagespeed unplugged;

        return 301 https://$server_name$request_uri;  # redirect all to use ssl

}


server {

    listen 443 ssl http2;

    server_name www.netsoluciones.com netsoluciones.com;

    add_header Cache-Control "max-age=86400,  public";

#    ssl on;

    ssl_certificate /etc/letsencrypt/live/DDDD/fullchain.pem; #
managed by Certbot

    ssl_certificate_key /etc/letsencrypt/live/DDDD/privkey.pem; #
managed by Certbot

    ssl_trusted_certificate
/etc/letsencrypt/live/www.netsoluciones.com/chain.pem;

    ssl_protocols  TLSv1.3 TLSv1.2;

    ssl_ciphers
ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GC

M-SHA384:ECDHE-RSA-AES256-SHA384;

    ssl_prefer_server_ciphers on;

    ssl_stapling on;

    ssl_stapling_verify on;

    add_header Strict-Transport-Security "max-age=31557600; includeSubDomains";

    add_header X-Xss-Protection "1; mode=block" always;

    add_header X-Frame-Options "SAMEORIGIN" always;

    add_header X-Content-Type-Options "nosniff" always;

    include /etc/nginx/default.d/pagespeed_filters.conf;

    keepalive_requests 1000;

    keepalive_timeout  5 5;

    ssl_session_cache shared:SSL:10m;

    ssl_session_timeout  30m;

     brotli on;

     brotli_comp_level 4;

     brotli_types text/plain text/css application/json
application/javascript application/x-javascript text/xml app

lication/xml application/xml+rss text/javascript;



location / {

        proxy_http_version 1.1;

        proxy_set_header Connection "";

        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_request_buffering off;

proxy_buffering off;
        proxy_pass http://backend00;


>
> So it is possible that the configuration that you are changing, is not
> the one that the running nginx is actively using.
>
> (Or maybe you are only showing a part of the configuration that is not
> used in this request?)
>
> The debug log does not show the locations /assets/ or /css/ or the like;
> it mainly shows locations related to the third-party pagespeed module.
>
> From what you describe, the browser should make a request to the "front"
> nginx server, which should use its proxy_pass config to make a request
> to the "backend" nginx server, which should then do whatever it is
> configured to do.
>
> It is not clear to me what request is being made to the "front" server,
> that is not being handled as you want it to be.
>
> > location /assets/ {
> >
>

I adapted that last configuration in the backend from an example I saw
on the internet of a person with a similar problem, but it doesn't
work for me so I'll delete it.

> More information.
>
> It looks like you want the "/assets/" request to be handled by serving a
> file from the filesystem; but that seems unrelated to php, friendly urls,
> and two languages.
>
> So if you can describe how you want one specific request to be handled,
> and can show how it actually is handled, maybe the first place where
> those two things differ can be identified.
>
> Cheers,
>

I hope that by looking at the site you have a better idea.

thnk.


-- 
rickygm

http://gnuforever.homelinux.com


More information about the nginx mailing list