Setting codeigniter on server with folder url path - apache

I tried to put my codeigniter project into server, I want to achieve these schemas:
visit http://156.67.214.100/sso will visit /var/www/sso
visit http://156.67.214.100/purchasing will visit /var/www/purchasing
my config for folder sso is:
<VirtualHost *:80>
ServerName 156.67.214.100/sso
ServerAdmin webmaster#localhost
DocumentRoot /var/www/sso/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
allow from all
</Directory>
</VirtualHost>
but when i try to visit http://156.67.214.100/sso will result page not found, because apache think the root is http://156.67.214.100, i want to the root is http://156.67.214.100/sso

My start on my virtualhost.
<VirtualHost 156.67.214.100/sso:80>
ServerName 156.67.214.100/sso
ServerAlias 156.67.214.100/sso
DocumentRoot /var/www/sso/
I have a entry on /etc/hosts:
#(server ip)
192.168.0.10 156.67.214.100/sso
Each server is a strange world, just try to know!
Maybe it helps!

Related

Apache Virtual Hosts for Two Sites Not Working Properly

I am trying to have two separate sites with Apache virtual hosts on a test server. I am going to access the sites with the ip address of the instance (for example, http://167.275.122.215). When I enable the following configuration, I would be able to load the first site with just the ip address correctly (with http://167.275.122.215), but not http://167.275.122.215/exp. I get a 404 error when I point to that address. What am I doing wrong here?
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/main
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
Alias /exp /usr/share/wordpress
DocumentRoot /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride all
DirectoryIndex index.php
require all granted
</Directory>
</VirtualHost>
In fact, my need is to be able to access the exp (experimental) site through the same ip while the main site is still available (from the original ip address). I tried giving a different port to the experimental site too (like below), but that still gave me a site can't be reached error.
<VirtualHost *:90>
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride all
DirectoryIndex index.php
require all granted
</Directory>
</VirtualHost>
For port based multiple sites, listing the default port as the second site resolved the issue:
LISTEN 90
<VirtualHost *:90>
DocumentRoot /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride all
DirectoryIndex index.php
require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/main
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Apache VirtualHost redirection from different subdomains

I have a DO droplet (Ubuntu 18.04) on which I want to host two sites. Let's say the droplet has an IP of 101.1.1.1. Now I want the sites to be pointed from another server (with different IP, let's say 104.1.1.1.) subdomain. Let's say siteone.example.org and sitetwo.example.org. So I follow the guides and set my Apache VirtualHost like this:
<VirtualHost *:80>
ServerAdmin webmaster#example.org
ServerName siteone.example.org
ServerAlias www.siteone.example.org
DocumentRoot /var/www/siteone/public_html
<Directory /var/www/siteone/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
However, when I press siteone.example.org in my browser I get no response. I've set A name in both to point ends to point to 101.1.1.1. Is there something I'm doing wrong?
You want 2 web sites on the same machine, each with an IP address? So:
configure both IP on your system
Set both IP:80 in Listen
Configure one VirtualHost per IP / domain
Like so:
Listen *.80
<VirtualHost 101.1.1.1:80>
ServerName siteone.example.org
ServerAlias www.siteone.example.org
ServerAdmin webmaster.example.org
DocumentRoot "/var/www/siteone/public/html"
<Directory /var/www/siteone/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/siteone_error.log
CustomLog ${APACHE_LOG_DIR}/siteone_access.log combined
</VirtualHost>
<VirtualHost 104.1.1.1:80>
ServerName sitetwo.example.org
ServerAlias www.sitetwo.example.org
ServerAdmin webmaster.example.org
DocumentRoot "/var/www/sitetwo/public/html"
<Directory /var/www/sitetwo/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/siteotwo_error.log
CustomLog ${APACHE_LOG_DIR}/sitetwo_access.log combined
</VirtualHost>
In your DNS, configure:
101.1.1.1 siteone.example.org www.siteone.example.org
104.1.1.1 sitetwo.example.org www.sitetwo.example.org

you don't have permission to access / on this server. apache 2.4

I'm having the problem
you don't have permission to access / on this server. apache 2.4
while accessing my local web site. I already googled a lot and read a lot of posts here in StackOverflow and everything seems to be correct.
This is my apache version:
Server version: Apache/2.4.27 (Unix)
Attached my httpd.conf file.
Here is my httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost.smatchme.com
DocumentRoot "/Users/samuelrabini/Project/SmatchMe/smatchme.web"
ServerName localhost.smatchme.com
<Directory /Users/samuelrabini/Project/SmatchMe/smatchme.web>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
</Directory>
DirectoryIndex index.php
ErrorLog "/private/var/log/apache2/localhost.smatchme.com-error_log"
CustomLog "/private/var/log/apache2/localhost.smatchme.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost.piuproduct.com
DocumentRoot "/Library/WebServer/Documents/piuproduct/public"
ServerName localhost.piuproduct.com
<Directory /Library/WebServer/Documents/piuproduct>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog "/private/var/log/apache2/localhost.piuproduct.com-error_log"
CustomLog "/private/var/log/apache2/localhost.piuproduct.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost.b2b.com
DocumentRoot "/Library/WebServer/Documents/b2b.tony"
ServerName localhost.b2b.com
<Directory /Library/WebServer/Documents/b2b.tony>
AllowOverride All
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/localhost.b2b.com-error_log"
CustomLog "/private/var/log/apache2/localhost.b2b.com-access_log" common
</VirtualHost>
Can anyone help me understand what I'm doing wrong?
I'm trying to access my site via http://localhost.b2b.com/
And I added in the /etc/hosts the entry:
127.0.0.1 localhost.b2b.com
thanks in advance
Samuel

apache virtual host not working for laravel app on digitalocean IP

I have create virtual host, but not working I am using digitalocean IP
<VirtualHost *:80>
ServerName ip/laravelblog
ServerAlias www.ip/laravelblog
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/laravelblog/public
#/etc/apache2/sites-available/laravelbog.conf
<Directory /var/www/html/laravelblog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
000-default.conf is also enabled and laravelblog also.
my url is ip/laravelblog ( I am using digitalocean IP). when I access my url (ip/laravelblog). its show all laravel folder. I need to point direct public folder.
I have solved the problem.
<VirtualHost *:80>
#ServerName
ServerAlias IP
Alias /project1 /var/www/html/project-path/public
Alias /project2 /var/www/html/project-path/public
DocumentRoot /var/www/html
<Directory "/var/www/html/>
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
the url will be IP/project1
for other project IP/project2
So you can add more and more Alias on one IP

Apache - vHost - Forbidden

I am trying to make a vhost that point "*:9090" to a specific directory. I'll explain.
That print below shows it's working the path i want.
So, I am trying to do "*:9090" point to this path (/wamp/www/root/dev). Below what i tried.
<VirtualHost *:9090>
DocumentRoot "c:/wamp/www/root/dev"
<Directory c:/wamp/www/root/dev>
Options all
Allow from all
AllowOverride All
Require all granted
</Directory>
And now, below, a print of my result.
What am i doing wrong?
I had the same issue until I used this:
<Virtualhost *:80 >
ServerName site.domain.com
DocumentRoot /path/to/site
<Directory /path/to/site>
AllowOverride All
Require all granted
</Directory>
ServerAdmin user#domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</Virtualhost>