index.html under /var/www/html not opening - apache

I just provisioned an AWS EC2 Linux Server and performed the following tasks.
1) Installed Tomcat.
2) Installed MySQL DB Server.
3) Apache HTTP Server.
4) Started the Apache HTTPD Server.
5) Changed the httpd.conf to have to have
ServerName www.mywebsitename.com:80 --[mywebsitename is placeholder here]
6) etc/hosts file modified to have 127.0.0.1 www.mywebsitename.com
7) "/var/www/html" has already "Hello World" content in index.html file.
8) Other entries in httpd.conf file
DocumentRoot "/var/www/html" &
DirectoryIndex index.html index.html.var
CONCERN:
When I type the IP address from external computer, it should display index.html page as UI. But this is not happening. This is the problem. I tried the same with my website address also. In both the cases(IP and website) it takes lot of time and then displays "This page can’t be displayed" etc.
Please help.
Apologize if I am missing something.
Thanks!

This was taken care. Problem was the port 80 which was not open as part of inbound security rules. As soon as it got opened page got opened.

Related

New Ubuntu server with Virtual Host show directory instead of website

I'm setting up a new Ubuntu 16.04 server with Apache. I followed this guide to do my setup.
Now when I try to access the site it shows me an empty directory. If I try to access a specific file (index.html) the server doesn't find it. Even trying to see the default website (by accessing my public IP) I get an empty directory.
Here's my .conf file:
ServerAdmin admin#website.com
ServerName website.com
ServerAlias www.website.com
DocumentRoot /var/www/website.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
(for the purpose of this public question I changed the name of the site for website.com)
All file's and folder's rights are set to my username as owner and www-data as group. Apache's error log shows nothing wrong and access log is empty.
I banged my head for hours on this issue without any progress so any help is welcome!
Thanks
P.S.: The server is Ubuntu Server 16.04 LTS 64b running on a VirtualBox VM.
Obiviously you have missed out something. Please check that you have
/var/www/example.com/public_html/index.html
with correct spellings.
Also make sure that the config has both index.html and index.php in DirectoryIndex, check this link for more info
If all is correct create a .htaccess file in /var/www/example.com/public_html/
nano /var/www/example.com/public_html/.htaccess file
and then add the followings in it.
DirectoryIndex index.htm index.html index.php

Wamp server can't start (orange icon)

I can't start wamp server on win7. I'm using vhosts, everything was fine untill I restart wamp server.
httpd-vhost.conf:
<VirtualHost *:80>
ServerAdmin *.*#*.com
DocumentRoot "C:\Users\Rossko\Documents\PHP\wamp\www\***.local"
ServerName ***.local
ErrorLog "C:\Users\Rossko\Documents\PHP\wamp\apache\apache2.4.9\logs\***.local-error.log"
CustomLog "C:\Users\Rossko\Documents\PHP\wamp\apache\apache2.4.9\logs\***.local-access.log" common
in Apache error log is nothing and port 80 is empty. Why is still orange and failed to start? Any idea? I have more virtual hosts in httpd-vhost.conf than projects in www/ folder (not enough time for copy) Is it possible that the error is coused by this?
First, if Apache fails to start, look at the Windows Event Log under
Event Viewer -> Windows Logs -> Application
And then look for Errors report from a Source of Apache
If Apache fails before it can open its error log, errors are written to the Event log.
Second a good way to test your http.conf file and any files that are included within httpd.conf is to do this :-
Launch a command window (Dos Box)
C:
CD \Users\Rossko\Documents\PHP\wamp\apache\apache2.4.9\bin
httpd -t
This should validate the httpd.conf file and all included files, if there are errors they will be reported with a filename and a line number.
Fix the error and then try the httpd -t command again until it responds with an OK message.
If you have defined more Virtual Hosts than you have actually created DocumetRoot folders for, it should just report a cannot find file type message in the Apache error log on startup. It should not actually stop Apache from starting.

Cannot access to my server without writing the client's host

I have set up my OVH server, installing apache2, php5, mysql, phpmyadmin etc... And configured the vhosts.
The content of my VirtualHost file :
<VirtualHost *:80>
ServerName www.abracadabook.fr
ServerAlias abracadabook.fr *.abracadabook.fr
DocumentRoot /home/abracadabook/www/
<Directory /home/abracadabook/www/>
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>
When I type the ip address of my server, it displays the apache default page. But after setting up my windows hosts file (I'm on windows but the server's on linux), when I try accessing abracadabook.fr the site is loaded and the root directory is right (/home/abracadabook/www) and it displays the normal index of my website. But the problem is that the site is not accessible from another client machine.
When I try to access to it from a PC which host file is not set up, nothing will load even when I access it with the ip address.
I searched in many boards and forum but never found the solution.
I hope you can help me.
Regardly,
(PS Sorry for my bad english)
Turns out I had not the good informations.
I followed this tutorial step by step and it works well now.
Kimsufi DNS setting Tutorial (French)

XAMPP server document root for specific website

I just installed XAMPP, and I've found how to change the document root in the Apache config file, but I only want to change it for a specific site. The reason I need this is because all of my links are absolute links (i.e. /url not just url).
I tried changing it with .htaccess, but that gave me errors saying the limited recursion had been exceeded. So I went and changed that to 200, and it too a really long time, and then said that the recursion had been exceeded.
I would use aliases, but that would mean saying that any request to / goes somewhere else.
So is there anyway for me to specify that files inside of directory dir should have their document root as dir?
Thanks.
I found the solution, but it's a bit involved. You have to change the Apace config file, and the hosts file.
In the Apache config file, I added this:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/absolute path/from/C/drive"
ServerName site.local
</VirtualHost>
Then I had to add this in the hosts file:
127.0.0.1 site.local
You can read up more on the virtual host here: http://httpd.apache.org/docs/2.2/vhosts/examples.html

Apache and Cakephp application

I am running into issues with cakephp application running with CentOs. I did not change any setting in the default config other than added a file under conf.d which content as :
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/portal/
ServerName abc.mydomain.com
</VirtualHost>
When accessed, home page works i.e. app.mydomain.com shows up but none of the CSS,JS and img files are loaded which are under default structure
i.e. /var/www/portal/app/webroot/img
/var/www/portal/app/webroot/css
/var/www/portal/app/webroot/js
So I tried moving them right under /var/www/portal/ and that worked for homepage but clicking on any link on homepage just does 404. e.g. If link is abc.mydomain.com/test
In apache log I see the errors as 'File Does not exist : /var/www/portal/test' . It seems that apache is not sending the request to cakephp to process the url.
What could be wrong here? Most likely with the apache security settings but am not sure where to lool.
Is your AllowOverride set to all? Only then the CakePHP rewrite directives which are in .htaccess files start working. Alternatively, you can move them to the virtual host configuration and get them to work.
Ok, this is a common mistake. you should enable "rewrite" --> module rewrite. (this is of course a php module). in ubuntu you usually type sudo a2enmod rewrite. Check for CentOS command.