Nginx custom 404 page (configured under Linux)

Source: Internet
Author: User
404 errors are errors that are prone to the WWW site access.

The most common error hint: 404 Not FOUND. 404 error page settings on the site SEO has a great impact, and improper settings, such as direct to jump home, etc., will be the search engine down the right to pull hair. 404 The purpose of the page should be to tell the user: the page you requested is not there, and also guide the user to browse the site other pages instead of closing the window to leave. The search engine uses the HTTP status code to identify the state of the page. When the search engine gets a bad link, the site should return a 404 status code that tells the search engine to discard the index of the link. If a 200 or 302 status code is returned, the search engine will index the link, resulting in a number of different links pointing to the same page content. As a result, search engines have significantly reduced trust in websites.

    1. First open the Nginx.conf file and fastcgi_temp_file_write_size 128k; add the following

      fastcgi_intercept_errors on;(note, including ; number)

    2. And then in the site that needs to be defined (the author's file is the /alidata/server/nginx/conf/vhosts directory of the lbinin.conf file)

      root /alidata/www/lbinin;under Adderror_page 404 = /404.html;
      (/404.html indicates that the custom 404.html is placed in the server root directory)

      Similarly, to add a 403 page, the code is:error_page 403 = /403.html;

    3. Then save and restart Nginx.

Nginx start, stop, restart under Linux

/etc/init.d/nginx start/stop/restart/reload

For example, start Nginx:
/etc/init.d/nginx start

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the Nginx custom 404 page (configuration under the Linux environment), including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.