Apache2 404 Error
Contents |
In submit Tutorials Questions Projects Meetups Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main Site Sign Up Log In submit View All Results By: Justin Ellingwood apache2 custom 404 Subscribe Subscribed Share Contents Contents We hope you find this tutorial helpful. In
Apache2 404 Not Found
addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more → 6 How To Configure apache2 404 not found ubuntu Apache to Use Custom Error Pages on Ubuntu 14.04 Posted Jun 9, 2015 44.8k views Apache Ubuntu Introduction Apache is the most popular web server in the world. It is well-supported, feature-rich, and
Apache2 403
flexible. When designing your web pages, it is often helpful to customize every piece of content that your users will see. This includes error pages for when they request content that is not available. In this guide, we'll demonstrate how to configure Apache to use custom error pages on Ubuntu 14.04. Prerequisites To get started on with this guide, you will need a non-root user with apache tomcat 404 error sudo privileges. You can set up a user of this type by following along with our initial set up guide for Ubuntu 14.04. You will also need to have Apache installed on your system. Learn how to set this up by following the first step of this guide. Creating Your Custom Error Pages We will create a few custom error pages for demonstration purposes, but your custom pages will obviously be different. We will put our custom error pages in the /var/www/html directory where Ubuntu's Apache installation sets its default document root. We'll make a page for 404 errors called custom_404.html and one for general 500-level errors called custom_50x.html. You can use the following lines if you are just testing. Otherwise, put your own content in these locations:
- echo "
Error 404: Not found :-(
" | sudo tee /var/www/html/custom_404.html - echo "
I have no idea where that file is, sorry. Are you sure you typed in the correct URL?
" | sudo tee -a /var/www/html/custom_404.html - echo "
Oops! Something went wrong...
" | sudo tee /var/www/html/custom_50x.html - echo "
We seem to be having some technical difficulties. Hang tight.
" | sudo tee -a /var/www/html/cgeneric error responses in the event of 4xx or 5xx HTTP status codes, these
Apache 404 Error Page
responses are rather stark, uninformative, and can be intimidating to site users.
Php 404 Error
You may wish to provide custom error responses which are either friendlier, or in some language other apache 404 error on a file that exists than English, or perhaps which are styled more in line with your site layout. Customized error responses can be defined for any HTTP status code designated as an https://www.digitalocean.com/community/tutorials/how-to-configure-apache-to-use-custom-error-pages-on-ubuntu-14-04 error condition - that is, any 4xx or 5xx status. Additionally, a set of values are provided, so that the error document can be customized further based on the values of these variables, using Server Side Includes. Or, you can have error conditions handled by a cgi program, or other dynamic handler (PHP, mod_perl, etc) which makes use https://httpd.apache.org/docs/2.4/custom-error.html of these variables. Configuration Available Variables Customizing Error Responses Multi Language Custom Error Documents See alsoComments Configuration Custom error documents are configured using the ErrorDocument directive, which may be used in global, virtualhost, or directory context. It may be used in .htaccess files if AllowOverride is set to FileInfo. ErrorDocument 500 "Sorry, our script crashed. Oh dear" ErrorDocument 500 /cgi-bin/crash-recover ErrorDocument 500 http://error.example.com/server_error.html ErrorDocument 404 /errors/not_found.html ErrorDocument 401 /subscription/how_to_subscribe.html The syntax of the ErrorDocument directive is: ErrorDocument <3-digit-code>
where the action will be treated as: A local URL to redirect to (if the action begins with a "/"). An external URL to redirect to (if the action is a valid URL). Text to be displayed (if none of the above). The text must be wrapped in quotes (") if it consists of more than one word. When redirecting to a local URL, additional environment variables are set so that the response can be further customized. They are not sent to external URLs. Available Variables Redirecting to anoth here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and http://stackoverflow.com/questions/25007067/getting-404-not-found-website-with-apache2-on-ubuntu policies of this site About Us Learn more about Stack Overflow the http://stackoverflow.com/questions/4060034/404-not-found-error-when-trying-to-access-localhost-on-local-lamp-server company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes 404 error a minute: Sign up getting 404 not found - website with apache2 on ubuntu up vote 0 down vote favorite Background: I've installed apache2 and have tried set up virtual directories... but when I try to test the different sites, I keep getting 404 error messages. The article /tutorial I've been following is located at: https://www.digitalocean.com/community/tutorials/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps I have the following folder apache2 404 not structure in place: /var/www/webtest.com/test.html /var/www/ttimes.com/test.php In the /etc/apache2/sites-available folder, I have the following configuration files: jmj@cp-AOA150:/etc/apache2/sites-available$ ls -lah /var/www/ total 44K drwxr-xr-x 9 root root 4.0K Jul 28 21:37 . drwxr-xr-x 15 root root 4.0K Jul 28 19:54 .. drwxr-xr-x 2 root root 4.0K May 11 2013 current drwxr-xr-x 2 root root 4.0K Apr 3 08:21 html -rwxr-xr-x 1 root root 177 Nov 23 2013 index.html -rwxr-xr-x 1 root root 124 Jul 28 20:14 test.php drwxr-xr-x 5 jmj root 4.0K Jun 6 11:58 ttimes.com drwxr-xr-x 2 jmj root 4.0K Jul 28 21:21 webtest.com Here's what the webtest.com.conf file looks like:
ServerAdmin admin@webtest.com ServerName webtest.com ServerAlias www.webtest.com DocumentRoot /var/www/webtest.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Here's what my hosts file looks like: 127.0.0.1 localhost 127.0.1.1 cp-AOA150 This is all just on a local dev box where I want to have multiple sites located under /var/www. Once the site is developed, I'm going to move them to my hosting company. I currently don't have other IP addresses to add, so I skipped the step of adding VPS server IPs. I amhere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 404 Not Found Error when trying to access localhost on local LAMP server up vote 1 down vote favorite 1 I'm running Ubuntu. My Apache2 default file looks like this:
ServerAdmin webmaster@localhost DocumentRoot /var/www/ I have this file called Index.php in /var/www/ phpinfo(); ?> When I access http://localhost/ in my browser, I'm getting the 404 Not Found error: The requested URL / was not found on this server. Apache/2.2.16 (Ubuntu) Server at localhost Port 80 What am I doing wrong? This actually worked when I first setup LAMP but it's not working now. php apache ubuntu http-status-code-40Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/"Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128