Preface#
Do you face thousands of advertisements every day and cannot find the answers you need from search engines? Then you can try to build your own search engine. You can subscribe to this site through the RSS button below.
Building Environment#
- Server: I use Alibaba Cloud's Hong Kong machine, but you can also buy discounted machines overseas. It is recommended to choose non-mainland China machines with a configuration of 2H2G (in theory, 1H1G can also be used for building).
- The system is CentOS. The tutorials are based on CentOS, but you don't have to reinstall CentOS specifically. I just prefer to use CentOS.
- Docker environment
- docker-compose
Building Tutorial#
Docker#
You can use the Docker one-click installation command to install it, and there should be no errors. (At least not for me)
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
You can also use the one-click installation command from daocloud in China
curl -sSL https://get.daocloud.io/docker | sh
docker -v # Check Docker version
systemctl enable docker # Set to start on boot
Installing docker-compose#
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.1.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check docker-compose version
Installing searxng#
First, let's arrange a home for the configuration file (set a path)
cd /usr/local
Then clone the git repository
git clone https://github.com/searxng/searxng-docker.git
Reverse Proxy#
Because Caddy is used by default. If your server is also running Nginx for other websites, it will prevent SearXNG from running. You can choose to give up Nginx.
Modify the env configuration file
nano .env # Remove the comments, modify the host to your domain name, and modify the email to your email address.
After making the modifications, press Ctrl + X to exit, press Y to save the changes, and press Enter to confirm.
Generate a secret key, execute the command directly
sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml
I will use the Baota panel in the following steps. If you don't know how to install the Baota panel, please go to the official website of Baota to use the installation command to install the Baota panel.
First, find the home of the configuration file
Delete the part about Caddy in docker-compose.yaml
If you need to modify the port, modify it here
Then add a reverse proxy configuration using Baota, the target URL is http://127.0.0.1:8080. If you modified the port above, replace 8080 with the modified port, and submit it.
Click on the reverse proxy configuration file
Delete all the contents inside and replace them with the following code
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;
}
Note that you should change 8080 to the port you set, and then save it.
Nginx reverse proxy is successful.
Start SearXNG#
Make sure you are in the searxng-docker directory. If you are not, use the following command to cd to this directory
cd /usr/local/searxng-docker
Then start SearXNG
sudo docker-compose up
If there are no problems, let Docker run in the background
sudo docker-compose up -d
If this article has helped you, you can subscribe to this site through the RSS button below, or you can buy Itakashi a cup of tea.