Collage

n. A piece of art made by sticking various different materials, aka PHENOMENA Magazine
server

server

John Doe · April 24, 2025, 8:12 a.m.
nginx
Neither of above helped in my case - IP connection to http works as expected but https was redirecting to alphabetically first https virtual site. What was working witn nginx below 1.19.4 was to add null certificate to block: server { listen 80 default_server; listen [::]:80 default_server; listen 443 default_server; listen [::]:443 default_server; ssl_certificate /etc/ssl/null.crt; ssl_certificate_key /etc/ssl/null.key; server_name ""; return 444; }   Certificte can be generated with empty CN so you need no worry about fill it. sudo openssl req -x509 -newkey rsa:2048 -days 10000 -nodes -subj "/C=US/ST=Florida/L=XXXXX/O=Foo Inc./OU=IT/CN=X" -keyout null.key -out null.crt   Then http/https returns 444 (ERR_EMPTY_RESPONSE), in different configurations https returns ERR_HTTP2_PROTOCOL_ERROR with your null certificate which is also fine to show there is nothing there. For nginx 1.19.4 it is simpler. It introduced ssl_reject_handshake on | off (http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_reject_handshake) you can replace certificates 'stuff' with: server { listen 80 default_server; listen [::]:80 default_server; listen 443 default_server; listen [::]:443 default_server; ssl_reject_handshake on; server_name ""; return 444; }   And now you get http 444 (ERR_EMPTY_RESPONSE) and for https ERR_SSL_UNRECOGNIZED_NAME_ALERT. No null certificates are needed.   Ref. how to disable direct access to a web site by ip address I have a website on a VPS. The issue I am having is that when I enter the IP of the server, it links to the website. Even when entering mail.domain.com, it does the same thing. How do I disable t... https://stackoverflow.com/questions/29104943/how-to-disable-direct-access-to-a-web-site-by-ip-address OpenSSL: A problem with Field Name abbreviations? I am trying to create a new private key and CSR file for a colleague with some provided details: C = US S = Florida L = XXXXX O ... https://stackoverflow.com/questions/55541601/openssl-a-problem-with-field-name-abbreviations
John Doe · Nov. 28, 2023, 9:14 p.m.
nginx ssl
John Doe · Aug. 6, 2023, 8:52 a.m.
LinkedIn sharing has not worked for me. So I checked a URL from LinkedIn’s Post Inspector.     A 400 error has occurred. I checked the server error log again. [error] 4993#4993: *22595 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 1.1.1.1, server: example.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix://www/webservice.sock:", host: "example.com", referrer: "url" This snippet is for future me. Most answers for this problem you'll see are related to PHP. This issue is related to the buffer size in the uWSGI. Probably your requests have a long query parameters and cookies.   First, I added the following code to nginx.conf: reset_timedout_connection on; keepalive_requests 1000; send_timeout 30; server_names_hash_max_size 2048; #access_log /var/log/nginx/access.log; access_log off; log_not_found off; but it still has not worked.   One setting that occasionally needs to be adjusted is UWSGI_BUFFER_SIZE. The default value is 4096. If you plan to receive relatively big requests, you'll need to change this parameter value. You can tune it up to 65535. I do it in my application config uwsgi ini file. ( basically ini file is in /etc/uwsgi/ ) buffer-size=32768   * If you want to show an OG image, then you have to resize the image to 1200 px, etc. My image was 4032x3024, and it didn't show up.   Now everything works fine. :)   Ref. uWSGI. recv() failed (104: Connection reset by peer) while reading response header from upstream / abstractkitchen.com abstractkitchen.com uWSGI. recv() failed (104: Connection reset by peer) while reading response header from upstream Posted by Dmitry Updated on December 04, 2022 python uwsgi error snippet nginx [error] 4993#4993: *22595 recv() failed (104: Connection re https://abstractkitchen.com/blog/recv-failed-connection-reset-by-peer/ How to manage uWSGI configuration - Divio Documentation Divio Documentation Contents Menu Expand Light mode Dark mode Auto light/dark mode Hide navigation sidebar Hide table of contents sidebar Toggle site navigation sidebar Divio Documentation Toggle Light / Dark / Auto color theme Toggle table of contents si https://docs.divio.com/en/latest/how-to/uwsgi-configuration/ https://yoast.com/help/linkedin-sharing-not-working/ uwsgi invalid request block size I am running uwsgi in emperor mode uwsgi --emperor /path/to/vassals/ --buffer-size=32768 and getting this error invalid request block size: 21327 (max 4096)...skip What to do? I also tried -b 32768. https://stackoverflow.com/questions/15878176/uwsgi-invalid-request-block-size Where do you create the ini file? (Uwsgi) my reference: https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/uwsgi/ my project name: 'mysite' my directories: I create 'uwsgi.ini'. then, I written in ini file. [uwsgi] chdir=/var/ww... https://stackoverflow.com/questions/70811918/where-do-you-create-the-ini-file-uwsgi
John Doe · June 26, 2023, 3:45 a.m.
python uwsgi nginx
Step 1. Installing Certbot # apt-get install letsencrypt or # apt-get install certbot   Step 2. Confirming Nginx’s Configuration To check, open the server block file for your domain using nano or your favorite text editor: # sudo nano /etc/nginx/sites-available/your_domain Find the existing server_name line. It should look like the following: server { listen 80; } server { listen 80; server_name your_domain www.your_domain; root /home/myuser3/www; } If it does, exit your editor and move on to the next step.   Step 3. Obtaining an SSL Certificate (The webroot plugin works by creating a temporary file for each of your requested domains in ${webroot-path}/.well-known/acme-challenge.) # letsencrypt certonly --webroot --webroot-path=/home/myuser3/www -d your_domain.com -d www.your_domain.com * How to Solve Error 404 Not Found & How to Fix it Failed authorization procedure. your_domain.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: 160.153.63.10: Invalid response from https://www.your_domain.com/.well-known/acme-challenge/ABCDE12345: 404, www.your_domain.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: 160.153.63.10: Invalid response from https://www.your_domain.com/.well-known/acme-challenge/VWXYZ67890: 404 IMPORTANT NOTES: - The following errors were reported by the server: Domain: your_domain.com Type: unauthorized Detail: 160.153.63.10: Invalid response from https://www.your_domain.com/.well-known/acme-challenge/ABCDE12345: 404 Domain: www.your_domain.com Type: unauthorized Detail: 160.153.63.10: Invalid response from https://www.your_domain.com/.well-known/acme-challenge/VWXYZ67890: 404 To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. Edit Nginx’s Configuration location /.well-known { alias /root/folder/$site_name/.well-known/$1; } * If successful, you will receive the following output: Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Obtaining a new certificate Performing the following challenges: http-01 challenge for your_domain.com http-01 challenge for www.your_domain.com Using the webroot path /root/folder/your_domain for all unmatched domains. Waiting for verification... Cleaning up challenges Running deploy-hook command: systemctl reload nginx IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/your_domain/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/your_domain/privkey.pem Your cert will expire on 2023-09-18. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le   Step 4. Edit Nginx’s Configuration Add this block: #ssl beginning ssl on; ssl_certificate /etc/letsencrypt/live/your_domain/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/your_domain/privkey.pem; ssl_dhparam /etc/ssl/certs/dhparam.pem; #ssl end   Ref. How To Secure Nginx with Let's Encrypt on Ubuntu 18.04 | DigitalOcean New! Premium CPU-Optimized Droplets are now available. Learn more ->We're hiringBlogDocsGet SupportContact SalesProductsFeatured ProductsDropletsScalable virtual machinesKubernetesManaged Kubernetes clustersCloudwaysManaged cloud hostingApp PlatformGet ap https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04 Let’s Encrypt: How to Automatically Restart Nginx With Certbot – Arnon on Technology close search homeHome chatContact Me Categories labelGenerallabelHow-To GuideslabelMetalabelNewslabelOp-EdlabelServer Logs Explained Archives folderDecember 2021 folderJune 2021 folderMarch 2021 folderJanuary 2021 folderDecember 2020 folderOctober 2020 fo https://blog.arnonerba.com/2019/01/lets-encrypt-how-to-automatically-restart-nginx-with-certbot [Ubuntu] Let’s Encrypt 를 사용하여 무료로 SSL 사이트를 구축하는 방법 웹은 계속 발전하고 있으며, 여러 새로운 기술이 끊임 없이 등장하고 있다. 이 글에서는 웹 기술 중 하나인 SSL (Secure Socket Layer) 에 대해서 이야기 해 보고자 한다. < 그림 : OSI Model 에서 SSL 의 위치 >   정확히 말해서 SSL 은 전송계층과 (Transport Layer) 응용계층 (App… https://blog.lael.be/post/5107
John Doe · June 22, 2023, 11:33 p.m.
nginx Let’s Encrypt
<Without docker-compose.yml> 1. Install Docker 2. Elasticsearch 7.16.2 2-1. Install Elasticsearch # docker pull docker.elastic.co/elasticsearch/elasticsearch:7.16.2 2-2. Execute Elasticsearch # docker run -d -p 9200:9200 -p 9300:9300 --name es_x -e "discovery.type=single-node" -e "xpack.security.enabled=false" -e ES_JAVA_OPTS="-Xms200m -Xmx200m" docker.elastic.co/elasticsearch/elasticsearch:7.16.2 8fd1161fed14b8e048e0f929a37cfacbab56371dc4c2b134602469c321cc0421 2-3. Check Execution # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8fd1161fed14 docker.elastic.co/elasticsearch/elasticsearch:7.16.2 "/bin/tini -- /usr/l…" 45 seconds ago Up 43 seconds 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp es_x 2-4. Check your Elasticsearch settings # docker exec -i -t es_x cat /usr/share/elasticsearch/config/elasticsearch.yml cluster.name: "docker-cluster" network.host: 0.0.0.0 2-5. Stop # docker stop es_x es_x   <With docker-compose.yml> 1. See up to and including Item 2-1. 2. docker-compose.yml version: '3.6' services: elasticsearch: image: 'docker.elastic.co/elasticsearch/elasticsearch:7.16.2' container_name: es_a ports: - 9200:9200 environment: - node.name="es_a" - cluster.name="es-docker-cluster" - bootstrap.memory_lock=true - discovery.type=single-node #- "ES_JAVA_OPTS=-Xms200m -Xmx200m" volumes: - ./esdata:/usr/share/elasticsearch/data - ./eslog:/usr/share/elasticsearch/log ulimits: memlock: soft: -1 hard: -1 networks: - elastic deploy: resources: limits: memory: 1GB # Use at most 50 MB of RAM elasticsearch2: image: 'docker.elastic.co/elasticsearch/elasticsearch:7.16.2' container_name: es_b ports: - 9201:9200 environment: - node.name="es_b" - cluster.name="es-docker-cluster2" - bootstrap.memory_lock=true - discovery.type=single-node #- "ES_JAVA_OPTS=-Xms200m -Xmx200m" volumes: - ./esdata2:/usr/share/elasticsearch/data - ./eslog2:/usr/share/elasticsearch/log ulimits: memlock: soft: -1 hard: -1 networks: - elastic2 deploy: resources: limits: memory: 1GB # Use at most 50 MB of RAM volumes: esdata: driver: local driver_opts: o: bind type: none #device: /data esdata2: driver: local driver_opts: o: bind type: none #device: /data2 eslog: driver: local eslog2: driver: local networks: elastic: driver: bridge elastic2: driver: bridge # docker-compose -f docker-compose.yml up -d # docker-compose -f docker-compose.yml stop # docker-compose -f docker-compose.yml rm 3. Result # docker-compose -f docker-compose.yml up -d [+] Running 2/2 - Container es_a Started 2.1s - Container es_b Started # docker-compose -f docker-compose.yml stop [+] Running 2/2 - Container es_a Stopped 1.2s - Container es_b Stopped 3-1. 9200 { "name" : "\"es_a\"", "cluster_name" : "\"es-docker-cluster\"", "cluster_uuid" : "KwFTIgGCT7e8ZDNJIau6Jw", "version" : { "number" : "7.16.2", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb", "build_date" : "2021-12-18T19:42:46.604893745Z", "build_snapshot" : false, "lucene_version" : "8.10.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } 3-2. 9201 { "name" : "\"es_b\"", "cluster_name" : "\"es-docker-cluster2\"", "cluster_uuid" : "MZhKEnPuTdu5iNoatWOnQA", "version" : { "number" : "7.16.2", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb", "build_date" : "2021-12-18T19:42:46.604893745Z", "build_snapshot" : false, "lucene_version" : "8.10.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }   * If error raised 'Custom Analyzer [nori_korean] failed to find tokenizer under name [nori_tokenizer]' Install Korean (nori) Analysis Plugin # sudo bin/elasticsearch-plugin install analysis-nori The plugin must be installed on every node in the cluster, and each node must be restarted after installation.   * Cannot bind to some ports due to permission denied Run as admin: net stop winnat net start winnat   Ref. Docker bind elasticsearch volume in app folder I have the following docker-compose file : version: "3.3" services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:6.1.1 volumes: - esdata:/usr/share/ https://stackoverflow.com/questions/52373356/docker-bind-elasticsearch-volume-in-app-folder Docker, running multiple container (elasticsearch) I'm running one elasticsearch with version: '3' services: elasticsearch: build: context: . dockerfile: ./compose/elasticsearch/Dockerfile args: - VERSION=${VERSION} - M... https://stackoverflow.com/questions/59500443/docker-running-multiple-container-elasticsearch Enable Hyper-V on Windows 10 Install Hyper-V on Windows 10 https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v ElasticSearch on docker - 2nd instance kills the first instance I'm trying to run multiple versions of ElasticSearch at the same time, should be easy. Here are my commands: docker run -d --rm -p 9250:9200 -p 9350:9300 --name es_5_3_3_integration -e "xpack.sec... https://stackoverflow.com/questions/47540547/elasticsearch-on-docker-2nd-instance-kills-the-first-instance ElasticSearch - cannot run two es docker containers at the same time ElasticSearch - cannot run two es docker containers at the same time I'm trying to run 2 services of ElasticSearch using docker-compose.yaml Every time I run docker-compose up -d only one service is https://stackoverflow.com/questions/72273655/elasticsearch-cannot-run-two-es-docker-containers-at-the-same-time Cannot bind to some ports due to permission denied For the last 3 months or so I'm having random errors where I can't bind a specific port where our Identity server is running on my local development workstation. At first I thought it's my broken m... https://stackoverflow.com/questions/48478869/cannot-bind-to-some-ports-due-to-permission-denied [Windows 10] Docker 설치 완벽 가이드(Home 포함) Docker는 경량 가상화 기술인 리눅스 컨테이너 도구입니다. Windows 10 Home과 Pro에서도 몇 가지 설정을 통해 Docker Desktop으로 리눅스 컨테이너를 사용할 수 있습니다. 이 글에서는 Windows 10에서 Docker Desktop을 설치하는 방법을 총 정리합니다. https://www.lainyzine.com/ko/article/a-complete-guide-to-how-to-install-docker-desktop-on-windows-10/ 윈도우10 WSL2 설치하기, WSL2 우분투 설치하기 WSL이란? Linux용 Windows 하위 시스템을 사용하면 개발자가 기존 가상 머신의 오버헤드 또는 듀얼 부팅 설정 없이 대부분의 명령줄 도구, 유틸리티 및 애플리케이션을 비롯한 GNU/Linux 환경을 수정하지 않고 Windows에서 직접 실행할 수 있습니다. WSL2와 WSL1 비교 WSL 2는 Windows 10, 버전 1903, 빌드 18362 이상에서만 사용할 수 있습니다. 윈도우10에서 WSL2 설치해서 우분투 리눅스를 이용해보자 1. 윈 https://gaesae.com/161 Docker 기반의 Elasticsearch 설치 및 실행 본 문서에서는 Docker 환경에서 Elasticsearch 7.9 버전을 설치하고 실행하는 방법에 대해서 설명하고 있습니다. https://jinhokwon.github.io/devops/elasticsearch/elasticsearch-docker/ Korean (nori) Analysis Plugin | Elasticsearch Plugins and Integrations [6.4] | Elastic IMPORTANT: No additional bug fixes or documentation updates will be released for this version. For the latest information, see the current release documentation. Elastic Docs› Elasticsearch Plugins and Integrations [6.4]› Analysis Plugins « kuromoji_numbe https://www.elastic.co/guide/en/elasticsearch/plugins/6.4/analysis-nori.html#analysis-nori-install
John Doe · Feb. 7, 2023, 9:33 a.m.
elasticsearch docker
Yes and I did that recently with my laptop for experimentation with things that I would like to do with ES Cluster. This setup simplifies my environment, instead of using docker or using multiple machines/VMs/EC2 instances. You can download and use the .tar.gz file recommended above, and then you can do one of the following options option 1 - untar the file into two directories: es-01, es-02 then update the config file in each node option 2 - untar the file into one directory: es-instance, copy the config directory to another location with something like path/to/es-01/config, path/to/es-02/config then create a script to launch elasticsearch from the same binary location (which is es-instance) but use different config location (one for es-01/config, one for es-02/config) You need to update the following parameters in config/elasticsearch.yml file to separate one node from the other. cluster.name node.name path.data path.logs http.port   Can I run multiple Elasticsearch instances in one server? Can I run multiple Elasticsearch instances in one server? -If yes, How can I install 2 Elasticsearch instances in a single Linux server. I am aware if we use "yum install" will be installed without any issue. Thanks in Advance https://discuss.elastic.co/t/can-i-run-multiple-elasticsearch-instances-in-one-server/321230 how to run multiple instances of elasticsearch on one host I have several machines each with 128 GB of ram, each host is running a single instance of Elasticsearch. I would like to run another data node on each host and allocate around 30 GB to the jvm he... https://stackoverflow.com/questions/28482449/how-to-run-multiple-instances-of-elasticsearch-on-one-host   You need to prepare two elasticsearch.yml config files to configure settings accordingly and specify these files when startup up the two nodes. /elasticsearch/config/elasticsearch.yml /elasticsearch/config2/elasticsearch.yml /elasticsearch/config2/elasticsearch.yml cluster.name: trinitarian node.name: node-2 path.data: /path/to/data path.logs: path/to/logs network.host: 127.0.0.1 network.bind_host: 127.0.0.1 network.publish_host: 127.0.0.1 http.port: 9500   Linux Assuming your rpm or deb created an init.d script, to start a second node on the same machine do as follows: cd /etc/init.d cp --preserve elasticsearch elasticsearch2 Edit elasticsearch2 script: change # elasticsearch to # elasticsearch2 add node="2" after line prog="elasticsearch" change pidfile=/var/run/elasticsearch/${prog}.pid to pidfile=/var/run/elasticsearch/${prog}${node}.pid change lockfile=/var/lock/subsys/$prog to lockfile=/var/lock/subsys/$prog$node change echo -n $"Starting $prog: " to echo -n $"Starting $prog: (node $node)" change echo -n $"Stopping $prog: " to echo -n $"Stopping $prog: (node $node)" Save the file. Execute chkconfig --add elasticsearch2 service elasticsearch2 start I also had to add -Des.config=<path-to-second-config-files> to get it working   Run multiple elasticsearch nodes as a service on one Ubuntu-Server I have a server running Ubuntu 14.04 with 220 GB of ram on which I'd like to run elasticsearch. According to the documentation, one node should not have more than 32 GB of RAM, so I guess I have to... https://stackoverflow.com/questions/26162690/run-multiple-elasticsearch-nodes-as-a-service-on-one-ubuntu-server   Windows /elasticsearch/bin/elasticsearch-env2.bat if not defined ES_PATH_CONF ( set ES_PATH_CONF=!ES_HOME!\config2 ) /elasticsearch/bin/elasticsearch2.bat CALL "%~dp0elasticsearch-env2.bat" || exit /b 1   Check this: http://localhost:9200/ { "name" : "BEAST", "cluster_name" : "elasticsearch", "cluster_uuid" : "EVBl4ttGSWKP8MJJMivMCg", "version" : { "number" : "7.16.2", "build_flavor" : "default", "build_type" : "zip", "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb", "build_date" : "2021-12-18T19:42:46.604893745Z", "build_snapshot" : false, "lucene_version" : "8.10.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } http://localhost:9500/ { "name" : "node-2", "cluster_name" : "trinitarian", "cluster_uuid" : "QRUfSRYISH-20jU7x9yxog", "version" : { "number" : "7.16.2", "build_flavor" : "default", "build_type" : "zip", "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb", "build_date" : "2021-12-18T19:42:46.604893745Z", "build_snapshot" : false, "lucene_version" : "8.10.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }   Rebuild index: PS E:\pythonProjects\trinitarian\test> python manage.py search_index --rebuild --model xxx Are you sure you want to delete the 'board' indexes? [y/N]: y Deleting index 'board' Creating index 'board' Indexing 26 'Board' objects PS E:\pythonProjects\trinitarian\test>   Test with this code (test.py): import elasticsearch elastic = elasticsearch.Elasticsearch(hosts=["localhost:9200"]) indices = elastic.indices.get_alias().keys() print(indices) elastic2 = elasticsearch.Elasticsearch(hosts=["localhost:9500"]) indices2 = elastic2.indices.get_alias().keys() print(indices2)   Result: E:\pythonProjects\trinitarian\venv\Scripts\python.exe E:/pythonProjects/trinitarian/test/app/test.py dict_keys(['a', 'b', 'c', 'board']) dict_keys(['board']) Process finished with exit code 0
John Doe · Feb. 6, 2023, 4:18 a.m.
elasticsearch
Sometimes NGINX may show trailing slash in website URLs. Here’s how to remove trailing slash in NGINX to make your URLs look more intuitive.   Remove trailing slash in NGINX Here are the steps to remove trailing slash in NGINX.   1. Open NGINX configuration file Open terminal and run the following command to open NGINX server configuration file. $ sudo vi /etc/nginx/nginx.conf If you have configured separate virtual hosts for your website (e.g www.example.com), such as /etc/nginx/sites-enabled/website.conf then open its configuration with the following command $ sudo vi /etc/nginx/sites-enabled/website.conf 2. Remove trailing slash Add the following rewrite rule in server block as shown in bold. Replace example.com below with your domain name server { listen 80; server_name example.com; rewrite ^/(.*)/$ /$1 permanent; } In the above code, the rewrite statement will redirect all URLs to those without trailing slash. If you want to remove trailing slash from only a specific URL (e.g /product/) then update the rewrite statement as shown below. server { listen 80; server_name mydomain.com; rewrite ^/product/$ /product permanent; }   * You can also use this method. Remove the trailing slash from all paths except mypath. location ~ ^/mypath(.*) { try_files $uri @tomcat; } location ~ (?<no_slash>.*)/$ { return 301 $no_slash; } ... location / { try_files $uri @tomcat; } location @tomcat { ... }   3. Restart NGINX Server Run the following command to check syntax of your updated config file. $ sudo nginx -t If there are no errors, run the following command to restart NGINX server. $ sudo service nginx reload #debian/ubuntu $ systemctl restart nginx #redhat/centos
John Doe · Jan. 29, 2023, 9:54 p.m.
nginx
  • 1 (current)
  • 2