nginx - return http 410 code for every pathHow to publish a git repo via HTTP using nginx?How to set nginx...

Using は before 欲しい instead が

Why don't sharp and flat root note chords seem to be present in much guitar music?

Starships without computers?

90s(?) book series about two people transported to a parallel medieval world, she joins city watch, he becomes wizard

Why does my air conditioner still run, even when it is cooler outside than in?

What happened after the end of the Truman Show?

How can I get rid of this Lazy Spool, or otherwise improve this query's performance?

Count the frequency of items in an array

Why is su world executable?

Convert HTML color to OLE

"Silverware", "Tableware", and "Dishes"

Changing a TGV booking

Repurpose telephone line to ethernet

Why should someone be willing to write a strong recommendation even if that means losing a undergraduate from their lab?

Gofer work in exchange for Letter of Recommendation

Is there any road between the CA State Route 120 and Sherman Pass Road (Forest Route 22S0) that crosses Yosemite/Serria/Sequoia National Park/Forest?

Levenshtein Neighbours

Can I submit a paper under an alias so as to avoid trouble in my country?

Use of vor in this sentence

What are the ramifications of this change to upcasting spells?

How to dismiss intrusive questions from a colleague with whom I don't work?

How did Apollo 15's depressurization work?

Would it be illegal for Facebook to actively promote a political agenda?

Metal that glows when near pieces of itself



nginx - return http 410 code for every path


How to publish a git repo via HTTP using nginx?How to set nginx for http and httpsCan not change HTTPS to HTTP on NginxConfiguring nginx for my own purposesaudit2allow asks for a path when setting up nginx






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm trying to configure nginx to return a http 410 ("Resource Gone") code for any path under /



My config is below.



With this config, if I request /410test, I get a standard nginx 404 Not Found page, and a response status code of 404. So I'm having trouble even getting a response of 410 for one specific path, much less, all paths.



user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {
server {
location /410test {
return 410 "this is my 410 test page";
}

}


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

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

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

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

gzip on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}









share|improve this question









New contributor



David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




























    0















    I'm trying to configure nginx to return a http 410 ("Resource Gone") code for any path under /



    My config is below.



    With this config, if I request /410test, I get a standard nginx 404 Not Found page, and a response status code of 404. So I'm having trouble even getting a response of 410 for one specific path, much less, all paths.



    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;

    events {
    worker_connections 768;
    # multi_accept on;
    }

    http {
    server {
    location /410test {
    return 410 "this is my 410 test page";
    }

    }


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

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

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

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

    gzip on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    }









    share|improve this question









    New contributor



    David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0












      0








      0








      I'm trying to configure nginx to return a http 410 ("Resource Gone") code for any path under /



      My config is below.



      With this config, if I request /410test, I get a standard nginx 404 Not Found page, and a response status code of 404. So I'm having trouble even getting a response of 410 for one specific path, much less, all paths.



      user www-data;
      worker_processes auto;
      pid /run/nginx.pid;
      include /etc/nginx/modules-enabled/*.conf;

      events {
      worker_connections 768;
      # multi_accept on;
      }

      http {
      server {
      location /410test {
      return 410 "this is my 410 test page";
      }

      }


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

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

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
      ssl_prefer_server_ciphers on;

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

      gzip on;

      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
      }









      share|improve this question









      New contributor



      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm trying to configure nginx to return a http 410 ("Resource Gone") code for any path under /



      My config is below.



      With this config, if I request /410test, I get a standard nginx 404 Not Found page, and a response status code of 404. So I'm having trouble even getting a response of 410 for one specific path, much less, all paths.



      user www-data;
      worker_processes auto;
      pid /run/nginx.pid;
      include /etc/nginx/modules-enabled/*.conf;

      events {
      worker_connections 768;
      # multi_accept on;
      }

      http {
      server {
      location /410test {
      return 410 "this is my 410 test page";
      }

      }


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

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

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
      ssl_prefer_server_ciphers on;

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

      gzip on;

      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
      }






      nginx






      share|improve this question









      New contributor



      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited Aug 16 at 20:54







      David













      New contributor



      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked Aug 16 at 20:44









      DavidDavid

      32 bronze badges




      32 bronze badges




      New contributor



      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          2 Answers
          2






          active

          oldest

          votes


















          0














          You are missing the listen directive from the server block in your config. You are getting 404s from your sites defined under conf.d & sites-enabled.






          share|improve this answer

































            0














            Put return directly in the server context:



            http {
            server {
            return 410 "this is my 410 test page";
            }
            }


            Why it doesn't work with your config, is maybe because you're trying to access /410test/ (with trailing slash) which doesn't match your defined location.






            share|improve this answer




























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "106"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });






              David is a new contributor. Be nice, and check out our Code of Conduct.










              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535947%2fnginx-return-http-410-code-for-every-path%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              You are missing the listen directive from the server block in your config. You are getting 404s from your sites defined under conf.d & sites-enabled.






              share|improve this answer






























                0














                You are missing the listen directive from the server block in your config. You are getting 404s from your sites defined under conf.d & sites-enabled.






                share|improve this answer




























                  0












                  0








                  0







                  You are missing the listen directive from the server block in your config. You are getting 404s from your sites defined under conf.d & sites-enabled.






                  share|improve this answer













                  You are missing the listen directive from the server block in your config. You are getting 404s from your sites defined under conf.d & sites-enabled.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 days ago









                  Andrew ShulginAndrew Shulgin

                  16




                  16




























                      0














                      Put return directly in the server context:



                      http {
                      server {
                      return 410 "this is my 410 test page";
                      }
                      }


                      Why it doesn't work with your config, is maybe because you're trying to access /410test/ (with trailing slash) which doesn't match your defined location.






                      share|improve this answer






























                        0














                        Put return directly in the server context:



                        http {
                        server {
                        return 410 "this is my 410 test page";
                        }
                        }


                        Why it doesn't work with your config, is maybe because you're trying to access /410test/ (with trailing slash) which doesn't match your defined location.






                        share|improve this answer




























                          0












                          0








                          0







                          Put return directly in the server context:



                          http {
                          server {
                          return 410 "this is my 410 test page";
                          }
                          }


                          Why it doesn't work with your config, is maybe because you're trying to access /410test/ (with trailing slash) which doesn't match your defined location.






                          share|improve this answer













                          Put return directly in the server context:



                          http {
                          server {
                          return 410 "this is my 410 test page";
                          }
                          }


                          Why it doesn't work with your config, is maybe because you're trying to access /410test/ (with trailing slash) which doesn't match your defined location.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 16 at 21:11









                          Danila VershininDanila Vershinin

                          1785 bronze badges




                          1785 bronze badges

























                              David is a new contributor. Be nice, and check out our Code of Conduct.










                              draft saved

                              draft discarded


















                              David is a new contributor. Be nice, and check out our Code of Conduct.













                              David is a new contributor. Be nice, and check out our Code of Conduct.












                              David is a new contributor. Be nice, and check out our Code of Conduct.
















                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535947%2fnginx-return-http-410-code-for-every-path%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                              Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                              Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...