Apache virtualhost 403 - apache

I'm stuck on this 403 problem. I set up virtual host for apache on ubuntu, and when I access the site, it returns 403.
/etc/apache2/site-available/os.solesschong.com
<VirtualHost *>
DocumentRoot /root/mysoft/sns
ServerName oa.solesschong.com
ErrorLog ${APACHE_LOG_DIR}/oa.solesschong.com-error.log
CustomLog ${APACHE_LOG_DIR}/oa.solesschong.com-access.log combined
<Directory /root/mysoft/sns>
Allow from all
</Directory>
</VirtualHost>
# a2enable oa.solesschong.com
file
root/mysoft/sns/index.php
DNS
oa.solesschong.com A-record: [IP of my server]
browser return
Forbidden
You don't have permission to access / on this server.
Apache/2.2.22 (Ubuntu) Server at oa.solesschong.com Port 80

Does the Apache process have permission access to read to /root/mysoft/sns/index.php?

Check your version of apache. If it is 2.4 then you need change alow configuration from
Allow from all
to
Require all granted

Related

Redirect http default port to an application on same port - CentOS 7

I have an installation of httpd on my server and a web application on it (/var/www/html/app). I want to when a user enter the IP of my server over HTTP (123.125.21.45:80) this redirects to my application on same port (123.125.21.45:80/app)
I have created and app.conf in /etc/httpd/conf.d/app.conf
<VirtualHost *:80>
DocumentRoot /www/html/app
ServerName 123.125.21.45
</VirtualHost>
And the result on the web browser is
http://123.125.21.45/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/
What am I doing wrong?
Please use below virtual host file and then try.
Note: make sure you are not using any redirection from .htaccess file.
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName 123.125.21.45
Redirect permanent / http://123.125.21.45/app/
<Directory /var/www/html/>
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>

Restricting direct access to ip address giving error

I'm trying to restrict direct access of my website through IP address. I want to only let people to see my website through domain.
When I made research I got one solution.
I added new VirtualHost in apache2 sites-available with my domain name and it worked with http://IP-ADDRESS but when someone try with https://IP-ADDRESS it can be accessible.
Again added another VirtualHost with port 433 to restrict https access too but it gives error.
My VirtualHost :
<VirtualHost *:80>
ServerName 157.245.247.15
ServerAlias localhost
ServerAdmin admin#localhost
DocumentRoot /var/www/my-site.com
<Location />
Order Allow,Deny
Deny from All
</Location>
ErrorLog ${APACHE_LOG_DIR}/157.245.247.15-error.log
CustomLog ${APACHE_LOG_DIR}/157.245.247.15-access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName 157.245.247.15
ServerAlias localhost
ServerAdmin admin#localhost
DocumentRoot /var/www/my-site.com
<Location />
Order Allow,Deny
Deny from All
</Location>
ErrorLog ${APACHE_LOG_DIR}/157.245.247.15-error.log
CustomLog ${APACHE_LOG_DIR}/157.245.247.15-access.log combined
</VirtualHost>
Error :
This site can’t provide a secure connection157.245.247.15 sent an invalid response.
ERR_SSL_PROTOCOL_ERROR
Now i cannot access my website even IP or domain due to SSL Protocol Error. How it can be solved ?
My main goal is to block direct access to IP address in http or https.
My OS : Ubuntu
Web Server : Apache
Thanks
First of all you shouldn't use an ip address as servername or serveralias. You should use an fqdn (resolved by a dns or by en entry in your hosts file)
Second: i can't see any configuration about the https. Where are key, certificate and chain configured?
Third: your configuration is denying access to everything
<Location />
Order Allow,Deny
Deny from All
</Location>
and not giving access to anything else.

Issue in apache virtualhost

I have an elastic load balancer which direct all the requests at port 80 to my ec2 instance where i have apache installed and i have defined the main server configuration and a virtual host.
But all request are served by the main server defined in apache httpd.conf file.
my apache configuration is having following details:
DocumentRoot "/var/www/html" - for main server
And for sub domain requests:
<VirtualHost p2.neptunetimesheets.com:80>
ServerAdmin webexpertsujeet#gmail.com
DocumentRoot "/var/www/neptunev2"
ServerName p2.neptunetimesheets.com
#ServerAlias p1.neptunetimesheets.com
<Directory "/var/www/neptunev2">
Require all granted
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
</VirtualHost>
Is it due to the load balancer that is causing this issue ?

ZendFramework 2 - 500 Internal Server Error

Today I create my first project with Zend Framework2 and when using internal PHP cli-server in the root directory it works.
But when I try to configure virtual host in Apache2 I see only "500 Internal Server Error"
ZendFramework-2.4.2
PHP Version 5.5.9
Apache/2.4.7
/etc/apache2/sites-available/zend-default.conf
<VirtualHost *:80>
ServerName zend.local
DocumentRoot /var/www/html/zendframework/ZendSkeletonApplication/public
<Directory /var/www/html/zendframework/ZendSkeletonApplication/public>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
/etc/hosts
127.0.0.1 zend.local
127.0.0.1 localhost
if I remember correctly you have to enable mod_rewrite in your apache2.

Drupal error on bottom : Not Found The requested URL / was not found on this server

My website works but i have this error on bottom.
Not Found
The requested URL / was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at Port 80
this is my vhost configuration
<VirtualHost *:80>
ServerAdmin admin#xxxx.com
ServerName xxx.net
ServerAlias www.xxxx.net
DocumentRoot /var/www/xxxx.net/
<Directory /var/www/xxxx.net/>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ServerSignature Off
ErrorDocument 404 /var/www/xxxx.net/404.html
</VirtualHost>
My 404 page exist at this location /var/www/xxxx.net/404.html
Thx for you help !!!!
This may be malware code trying to load content from another host. I recommend to check your website.