I am using Apache server with Wamp to have something like this for a dev enviroment:
123.45.67.89/website-a/
123.45.67.89/website-b/
to get to this point I made 2 aliases that look like this:
Alias /website-a "c:/wamp64/www/website-a/public"
<Directory "c:/wamp64/www/website-a/public">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride all
#Require local
Require all granted
</Directory>
Alias /website-b "c:/wamp64/www/website-b/public"
<Directory "c:/wamp64/www/website-b/public">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride all
#Require local
Require all granted
</Directory>
the issue that I have is basically the fact that the CSS and JS files are not loaded and also when i go to /login there is a 404 error. it appears to reference only the route url and that is the IP 123.45.67.89.
What should I do in order to get this fixed?
Related
I have a Laravel project that is on a live server and I have made a copy to place in a development server. When I try to login, it says The requested URL /xxxx/login was not found on this server..
I am not quite sure what to do, as I changed my httpd.conf to
<Directory "/var/www">
AllowOverride All
Require all granted
</Directory>
and
<Directory "/var/www/html">
AllowOverride All
Require all granted
</Directory>
but I am still getting the same error after restarting apache. Is there any way to solve this?
I think you didn't config for the virtual host or you config it wrong.
You can find that config file under folder /etc/httpd/conf.d/vhosts/ Below are a sample file config:
$ cat /etc/httpd/conf.d/vhosts/yoursife.conf
<VirtualHost *:80>
ServerName yourdomain.com
ServerAdmin youradmin_server_mail
DocumentRoot /your_src_path/public/
<Directory "/your_src_path/public/" >
Options FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /your_src_path/public/logs/error_log
CustomLog /your_src_path/public/logs/access_log combined
</VirtualHost>
You can create a new file if you want.
I'm currently trying to deploy my Django 2.0 App on an Apache Web Server. However I'm experiencing difficulties in configuring it because my Virtual Host configuration overrides other Virtual Hosts which is used by other projects (Ruby and PHP WebApps). We only have one domain name at the moment so I cannot use other domain names to host my app.
Is it possible to serve different kind of apps with one domain name using Apache Virtual Hosts?
Since you can only have 1 VirtualHost (one domain, one port, one IP), you cannot create additionnal VH. You need to "split" the paths to the different applications some other way.
Let assume www.example.com:
ServerRoot "/some/path/apache"
[...] OTHER LoadModule directives [...]
LoadModule alias_module modules/mod_alias.so
Listen *:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
# Logs
LogLevel warn
CustomLog "logs/www.example.com_access-log" combined
ErrorLog "logs/www.example.com_error-log"
# Index file. Add as many as required for your applications
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
# Where the documents are
DocumentRoot "/some/path/apache/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/some/path/apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This VirtualHost is a basic configuration for the www.example.com domain. Now you want to have Ruby, PHP WebApps and Django 2.0 App under that single domain. You have 3 choices:
Get 1 domain per application, not applicable here, that is your question.
Make a sub-directory in htdocs, and a path in the URI for each application.
Put each application in some directory, not under DocumentRoot and use Alias.
Use sub-domains.
Not applicable.
Sub-directory and path
Create /some/path/apache/htdocs/Ruby, put your Ruby app. here.
Will be accessed via http://www.example.com/Ruby
Create /some/path/apache/htdocs/PHPWebApps, put your PHP app. here.
Will be accessed via http://www.example.com/PHPWebApps
Create /some/path/apache/htdocs/Django, put your Django app. here.
Will be accessed via http://www.example.com/Django
The URI value must match the directory value.
In some directory, use Alias
If you do not need, or want the URI to match the directory name (like in 2.), use Alias.
Create /SOME_DIR_FOR_Ruby, put your Ruby app. here.
Add Alias "/Ruby" "/SOME-DIR-FOR-Ruby"
Will be accessed via http://www.example.com/Ruby
Create /SOME_DIR_FOR_PHPWebApps, put your PHP app. here.
Add Alias "/PHPWebApps" "/SOME_DIR_FOR_PHPWebApps"
Will be accessed via http://www.example.com/PHPWebApps
Create /SOME_DIR_FOR_Django, put your Django app. here.
Add Alias "/Django" "/SOME_DIR_FOR_Django"
Will be accessed via http://www.example.com/Django
Use sub-domains
This is where you could use multiple VirtualHosts. But you have to be able to create sub-domains. This is done either via a DNS configuration, or through your hosting provider.
You could setup http://ruby.example.com, http://php.example.com, http://django.example.com. Each of these will have 1 VirtualHost, but will all be mapped to the same IP in the DNS.
Then setup 3 VH:
<VirtualHost *:80>
ServerName ruby.example.com
# Logs
LogLevel warn
CustomLog "logs/ruby.example.com_access-log" combined
ErrorLog "logs/ruby.example.com_error-log"
# Index file. Add as many as required for your applications
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
# Where the documents are
DocumentRoot "/some/path/apache/htdocs/Ruby"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/some/path/apache/htdocs/Ruby">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName php.example.com
# Logs
LogLevel warn
CustomLog "logs/php.example.com_access-log" combined
ErrorLog "logs/php.example.com_error-log"
# Index file. Add as many as required for your applications
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
# Where the documents are
DocumentRoot "/some/path/apache/htdocs/php"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/some/path/apache/htdocs/php">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName django.example.com
# Logs
LogLevel warn
CustomLog "logs/django.example.com_access-log" combined
ErrorLog "logs/django.example.com_error-log"
# Index file. Add as many as required for your applications
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
# Where the documents are
DocumentRoot "/some/path/apache/htdocs/django"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/some/path/apache/htdocs/django">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
On Apache 2.2, you have to add NameVirtualHost *:80, in Apache 2.4, nothing, it is always "on".
All these values can be changed as you like, this is just an example to explain the concept.
I need to include a folder on my httpd.conf that is out of my DocumentRoot directory. I know there is a lot of info about this but not specifically for Apache 2.4 running on Windows. I tried a lot of things but anything works, I always get a forbidden error, and this is driving me mad.
Here is my default config made by WAMP:
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +FollowSymLinks +Multiviews
AllowOverride all
Require local
</Directory>
That's OK but I need to include a folder project on my E:\ disk.
I have tried all of these, obviously restarting the apache server after every attempt:
Attempt #1
<Directory "e:/Development/[Git]/projectName/public/">
Require all granted
</Directory>
Attempt #2
<Directory "e:/Development/[Git]/projectName/public/">
Options +Indexes +FollowSymLinks +Multiviews
AllowOverride all
Require local
</Directory>
Attempt #3
Alias /projectName "e:/Development/[Git]/projectName/public/"
# The <Directory> on attempts #1 and #2
Just to clarify:
I have tried a lot of combinations using / or \. Also using " or without. I even tried to escape the [] like this \[Git\].
I already have a VirtualHost well configured for that directory. I know it because if I remove the security on the <Directory /> then works fine, but as I have read this is a lack of security that I do not want to have:
# Disabling the security as below is not an option
<Directory />
AllowOverride none
Require all granted
</Directory>
Can anyone help me please? Thanks in advance
I am using WAMP 3.06. I have a web site hosted in "c:/wamp64/www/webagenda"
When I try to access the site remotely using "http://cloudappoint.myvnc.com", I get:
Forbidden
You don't have permission to access /webagenda on this server.
Apache/2.4.23 (Win64) PHP/5.6.25 Server at agenda.myvnc.com Port 8000
My virtual host file is:
# Virtual Hosts
<VirtualHost *:8000>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#if I uncomment the next lines the problem is over
#<Directory "c:/wamp64/www/webagenda">
#Options Indexes FollowSymLinks Includes ExecCGI
#DirectoryIndex index.php
#AllowOverride None
#Require all granted
#</Directory>
<VirtualHost *:8000>
ServerName cloudappoint
ServerAlias cloudappoint.myvnc.com
DocumentRoot c:/wamp64/www/webagenda
ErrorLog "logs/agenda-error.log"
CustomLog "logs/agenda-access.log" common
<Directory "c:/wamp64/www/webagenda/">
Options +Indexes +FollowSymLinks +MultiViews
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
As you can see from my comments, if I I uncomment the next lines the problem is over:
<Directory "c:/wamp64/www/webagenda">
Options Indexes FollowSymLinks Includes ExecCGI
DirectoryIndex index.php
AllowOverride None
Require all granted
</Directory>
What is wrong here, please?
If moving the <Directory> block out of the <VirtualHost> block causes access to be allowed then it is a fair assumption that there is something wrong with the <VirtualHost> definition.
Can I suggest that you try this change in your definition
<VirtualHost *:8000>
ServerName cloudappoint.myvnc.com <--change
ServerAlias www.cloudappoint.myvnc.com <--change
DocumentRoot c:/wamp64/www/webagenda
ErrorLog "logs/agenda-error.log"
CustomLog "logs/agenda-access.log" common
<Directory "c:/wamp64/www/webagenda/">
Options +Indexes +FollowSymLinks +MultiViews
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
EDIT
I assume you are adding the non standard port number to the url when trying to access the site?
http://cloudappoint.myvnc.com:8000
When I add the :8000 I do not get the error I get an offline page saying
The site you have requested is currently unavailable,
please try back again later.
I am beginner in Laravel. I used Laravel 5.1 in Wamp Server (Apache/2.4.9 (Win64) PHP/5.5.12)
I received the 404 Not Found Error, when I called the page like
http://localhost/laravel/public/login
Route::get('login', function() {
//return View::make('login');
return 'Hello World'; });
vhost.conf code
ServerAdmin local#gmail.com
DocumentRoot "C:\wamp\www\laravel\public"
ServerName localhost
ErrorLog "logs/AuthorityController.www-error.log"
CustomLog "logs/AuthorityController.www-access.log" common
<Directory "C:\wamp\www\laravel\public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Try this: http://localhost/login
may be it helps you, i hope :). And check that you vhost in appache is set to .../your_laravel_project/public folder
UPDATE
Go to C:\Windows\System32\drivers\etc\hosts and add line at the bottom:
127.0.0.1 myproject.dev
Then, in your appache httpd.conf file you shoud uncoment line:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
BONUS: You can also switch directory with you projects in lines (for instance i have my projects in 'F:/Code'):
DocumentRoot "F:/Code"
<Directory "F:/Code">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
Next step, in your httpd-vhosts.conf you should have:
<VirtualHost myproject.dev>
DocumentRoot "F:\Code\myproject\public"
ServerName myproject.dev
ServerAlias myproject.dev
<Directory "F:\Code\myproject\public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Then reset appache. And when you go to your browser and put http://myproject.dev you should see your page :)
You don't need to do that anymore. Don't include that. What you do is put a view file (your 404 error view) called 404.blade.php in your resources/views/errors folder and Laravel will handle 404 errors for you.