Nginx custom 404 page (configured in Linux)

Source: Internet
Author: User
: This article mainly introduces the Nginx custom 404 page (configured in Linux). If you are interested in the PHP Tutorial, refer to it. 404 error is an easy-to-see error during WWW website access.

The most common error message is 404 not found. The setting of the 404 error page has a great impact on the SEO of the website. improper setting, such as directly switching to the home page, will be de-authorized by the search engine. 404 the purpose of the page should be to tell the user that the page you requested does not exist. at the same time, the user is guided to browse other pages of the website rather than closing the window and leaving. The search engine uses HTTP status codes to identify the status of webpages. When the search engine gets an error link, the website should return a 404 status code, telling the search engine to discard the index of the link. If a 200 or 302 status code is returned, the search engine creates an index for the link, which leads to a large number of different links pointing to the same webpage content. As a result, the search engine's trust in the website is greatly reduced.

  1. First open the nginx. conf filefastcgi_temp_file_write_size 128k;Add

    fastcgi_intercept_errors on;(Note, including;Number)

  2. Then in the site to be defined (the author's file is/alidata/server/nginx/conf/vhostsDirectory)

    Inroot /alidata/www/lbinin;Adderror_page 404 = /404.html;
    (/404.html puts the custom 404.html under the root directory of the server)

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

  3. Save and restart nginx.

Start, stop, and restart nginx in 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) ;}) ;}; script

    The above introduces the Nginx custom 404 page (configuration in Linux environment), including some content, hope to be helpful to friends who are interested in PHP tutorials.

    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.