hostname not working in another Tomcat server - apache

I have been using
127.0.0.1 localhost
127.0.0.12 www.example.com
in my hosts file in a previous tomcat server.
I downloaded another version of tomcat and the hostname www.example.com is not working it gives me 404 error I think there is a conflict when I tried for example:
127.0.0.1 localhost
127.0.0.12 www.example-s.com
It worked. But, I need my old hostname.
How do I solve this problem?

Please think twice:
You got an 404 error - which is an http status code!
This means that your DNS is working!
The 404 error means that your tomcat could not find the requested resource.
For example:
http://www.example.com/
resulting in 404 error will mean that maybe you have deleted the
Tomcat:webapps/ROOT
directory. Or you have changed the server.xml config.

Related

Error 404 - Not Found

Good Afternoon,
I'm elaborating a project and I've instaled php,mysql, apache2 in a virtualbox with ubuntu16.04.
I'm working locally and I've instaled laravel 5.3, I have an API running and created a new virtual host and placed the DocumentRoot my_folder and ServerName name_virtual_host. Then I went to my host files and placed a new line: 127.0.0.1 name_virtual_host. When I place on my browser http://name_virtual_host, the laravel page appears like it is supposed, but when I type in http://name_virtual_host/api, it gives back:
Not Found
The requested URL /api was not found on this server.
Apache/2.4.18 (Ubuntu) Server at name_virtual_host Port 80
it used to appear JSON.
How can I solve this?
Thanks.

DigitalOcean hosting with GoDaddy domain denying access to root directory

I own a domain on GoDaddy and am attempting to point it to my DigitalOcean-hosted website. Here are the steps I have taken so far:
I cloned the git repo containing all of my website files from local to my DigitalOcean server.
I added an # record on godaddy for my domain and pointed it to my DigitalOcean IP address.
IMPORTANT!! I modified /etc/apache2/sites-enabled/000-default.conf with my new VirtualHost pointing mydomain.com to index.html, NOT THE ROOT DIRECTORY.
I then proceeded to do 'service apache2 restart' while sshed to DigitalOcean on terminal.
I assumed this would work and then tested it out and went to mydomain.com. Not so much. This is the error I got:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80
This was obviously pretty surprising given that it was not redirecting to index.html, so I manually appended /index.html to mydomain.com only to find that it gave me an identical error only I could not access /index.html instead of /.
I have done this kind of things many times before, however I used subdomain records for godaddy on an existing domain instead of using a brand new domain with no subdomains. Where did I go wrong?
Thanks!
Brandon
UPDATE: I tried on a test subdomain with test.mydomain.com and got this new error:
Not Found
The requested URL / was not found on this server.
Apache/2.4.7 (Ubuntu) Server at test.mydomain.com Port 80
You noted you modified the virtual host to point to index.html but not the root directory. Apache would still use the root directory (DocumentRoot) to locate the index.html file. If it is looking in the wrong location it could explain the 403 error (looking in a place that the web server user [www-data] cannot read as an example).
Beyond that, a 403 like that could be permission related. You would want to ensure the DocumentRoot and index.html file have the ownership of www-data:www-data and they are all readable by the web server itself (755 for folders and 644 for files is the norm).

How do I find out where my root URL is being served from in Apache?

I've recently got a VPS server and it came installed with CentOS, WHM and cPanel. I'm trying to find where the physical folder location the root URL of the server IP is being served. When I go to the root IP in a browser, I get a redirect to "/cgi-sys/defaultwebpage.cgi" with "SORRY!" and some error resolve details.
The server has a web-site running under "/cPanel" and also WHM runs on ":2083".
I'm trying take control of the content served directly at the /, and replace that defaultwebpage.cgi with an index.html.
I've tried httpd -V to check where the httpd.conf, is and then spotted a <VirtualHost *> in that config file, which points to a DocumentRoot of /use/local/apache/htdocs . But if I place index.html in this folder and try to hit it via /index.html, I still get routed to that defaultwebpage.cgi. Can anyone help me understand why its rerouting and not picking up that index.html?
Thanks.
You may want to try /var/www/html, at least that's in Ubuntu
If it's not it, then try going to /etc/apache2/apache2.conf and find the DocumentRoot option.
Hope this helps!

Forcing localhost to use https results in a 403 error

I am working on a php website. I am working on it using Aptana with XAMPP. I recently changed my htaccess file to force my site to use https on the localhost. I haven't yet implemented a ssl certificate. When I try to access a webpage now, I am directed to a page that says:
Object not found!
The requested URL was not found on this server. If you entered the URL
manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.10 (Unix) OpenSSL/1.0.1j PHP/5.6.3 mod_perl/2.0.8-dev Perl/v5.16.3
I found some solutions to this but I really want to know why this is occurring. I know that I can change the httpd.conf file to fix it but I still don't understand what is happening.

Virtual host and subdomains on Wamp windows

I want to create virtual host and sub-domains for that host on local machine such that my localhost serve as a website like I do not need to write localhost in url bar:
localhost ---> mysite.com
---> sd1.mysite.com
---> sd2.mysite.com
actually I am using wordpress plugin WP Subdomains which makes sub-domain for main categories like.
cat1.localhost
cat2.localhost
but if we try to access cat1.localhost browser error Server not found which is definitely because we did not create sub-domain named cat1 for localhost.
I google but no solution found which exactly solve my problem.
I also followed http://www.talkphp.com/general/2170-setup-sub-domain-wamp.html
but following error appear:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, admin#localhost and inform
them of the time the error occurred, and anything you might have done
that may have caused the error.
More information about this error may be available in the server error
log.
Okay got it....
I followed http://www.talkphp.com/general/2170-setup-sub-domain-wamp.html but skip step 3:
Open up: C:\wamp\bin\apache\apache2.2.6\conf\extra\httpd-vhosts.conf.
and in httpd.conf comment DocumentRoot "E:/wamp/www/" and add
DocumentRoot "E:/wamp/www/wordpress"
and it work. :)
Please follow the link below. I tried this and working fine for me.
http://www.axertion.com/tutorials/2012/03/how-to-setup-local-subdomains-using-wampserver/