Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx instead of Caddy #15

Closed
abdalazizrashid opened this issue Apr 17, 2022 · 12 comments
Closed

Nginx instead of Caddy #15

abdalazizrashid opened this issue Apr 17, 2022 · 12 comments
Labels

Comments

@abdalazizrashid
Copy link

Is there an easy way to use Nginx?

@pleasehelp111
Copy link

pleasehelp111 commented Apr 19, 2022

Good day. I think this link has a good example of how to use nginx instead of Caddy.

@abdalazizrashid
Copy link
Author

abdalazizrashid commented Apr 19, 2022

The link doesn't direct to anything


EDIT: link has been fixed by @return42

@pleasehelp111
Copy link

pleasehelp111 commented Apr 24, 2022

Forgive me, this was the first time I've used the "link" feature on github website.
The solution that seemed to work for me was replacing caddy with this

 nginx:
    container_name: nginx
    image: lscr.io/linuxserver/nginx:latest
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./config:/config
    restart: on-failure 

and using this nginx config

user YOURNAME;
worker_processes 1;
pid /run/nginx.pid;
include /etc/nginx/modules/*.conf;

events {
	worker_connections 768;
}

http {

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	client_max_body_size 0;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	access_log /config/log/nginx/access.log;
	error_log /config/log/nginx/error.log;

	include /etc/nginx/http.d/*.conf;
	include /config/nginx/site-confs/*;
	#Removed lua. Do not remove this comment
  
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_min_length 10240;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;

    
    server {
        listen  YOURPORT;
        server_name  YOURSERVERNAME;

    location / {

        set $target YOURHOST;

        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_pass $target;
        }
    }
  }
}  
daemon off;

@extremelyonline
Copy link

Forgive me, this was the first time I've used the "link" feature on github website. The solution that seemed to work for me was replacing caddy with this
searx/searx-docker#63

Hi, did you change the filtron's rules.json to disable protection according to issue #63? Does this mean that along with #14, we lose both morty and filtron protection?

@mrpaulblack
Copy link
Member

Hi, did you change the filtron's rules.json to disable protection according to issue #63? Does this mean that along with #14, we lose both morty and filtron protection?

You dont need filtron and morty anymore. We switched our stack to using the limiter plugin in SearXNG core and the image_proxy feature also in SearXNG core. Our stack now consists of SearXNG, redis and any reverse proxy. Can you leave a quick comment if the nginx config worked for you, so I can close the issue? Thanks :D

@pleasehelp111 I edited #15 (comment) so there are proper coding blocks... Hope that is ok 👍

@extremelyonline
Copy link

Thanks @pleasehelp111 @mrpaulblack . Unfortunately, I was not able to use searxng with nginx successfully by:

  • Setting SEARXNG_BASE_URL to https://domain.ltd
  • Exposing port 8080:8080
  • In Nginx (I'm using linuxserver/swag), create a proxy for localhost:8080

I'm sorry I cannot provide more information, as nothing was in the docker log.

@xthursdayx
Copy link

@extremelyonline try this NGINX config configured to work with the SWAG docker container:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name searx.sublm.nl;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

location / {
    proxy_pass         http://<searxng-container-ip>:8080/;
    proxy_set_header   Host             $host;
    proxy_set_header   Connection       $http_connection;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   X-Scheme         $scheme;
    }
}

@mrpaulblack
Copy link
Member

proxy_pass http://<searxng-container-ip>:8080/;

you dont even need to use the container IP. You can use the container name and docker will automatically resolve the name to the container IP 👍

So for example if you named you SearXNG container searxng you can set this to http://searxng:8080/ 👍

@xthursdayx
Copy link

xthursdayx commented Apr 25, 2022

proxy_pass http://<searxng-container-ip>:8080/;

you dont even need to use the container IP. You can use the container name and docker will automatically resolve the name to the container IP +1

So for example if you named you SearXNG container searxng you can set this to http://searxng:8080/ +1

Since OP is using SWAG, this suggestion will only work if the SearXNG container is running on the same docker network as SWAG and will require the addition of this line to their proxy conf:

include /config/nginx/resolver.conf;

@extremelyonline
Copy link

extremelyonline commented Apr 26, 2022

Got it working now! I was having a DNS issue. I changed the SWAG subdomain.conf template to match the searxng container. Haven't tested the subfolder method.

@mrpaulblack mrpaulblack moved this to Needs Triage in SearXNG Issues May 8, 2022
@mrpaulblack mrpaulblack pinned this issue May 13, 2022
@mrpaulblack mrpaulblack moved this to Needs Triage in SearXNG Issues May 14, 2022
@mrpaulblack mrpaulblack moved this from Needs Triage to Discussion in SearXNG Issues May 14, 2022
@miaowmint
Copy link

miaowmint commented Jul 17, 2022

I'm not here to ask for help. I'm here to share my experience after a successful configuration.

In my case, there are already several web services on my server, port 80 is already occupied by Nginx, and I can't use Caddy. So my solution is SearxNG and Redis in Docker and Nginx on the host.
The process of building SearxNG and Redis is the same as in "readme", but be sure to delete the configuration of Caddy in docker-compose.yaml.
Then create a new website with Nginx, but the panel products I use automatically configure Nginx, so I can only provide the configuration of my reverse proxy as

location ^~ / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header Connection       $http_connection;
    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header X-Scheme         $scheme;
    proxy_buffering                   off;
}

image
If you change the mapped port of SearxNG in docker-compose.yaml, remember to change 8080 to the port you modified.

@Jeyso215
Copy link

You can use mines, It takes about 5 mins to setup and you have a fully working harden search engine for public and private use. With A+ Ratings already bulit-in for you to check your instance for security audits...

https://github.com/WhateverItWorks/my-SearXNG-Docker-Compose

@searxng searxng locked and limited conversation to collaborators Jun 19, 2023
@return42 return42 converted this issue into discussion #156 Jun 19, 2023
@github-project-automation github-project-automation bot moved this from Discussion to Closed in SearXNG Issues Jun 19, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
Status: Closed
Development

No branches or pull requests

7 participants