Setup vhost for subdomain
up vote
1
down vote
favorite
I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:
Not Found
The requested URL /home was not found on this server.
Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80
(I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:
<VirtualHost 127.0.1.1:80>
DocumentRoot /var/www/c2c/www
ServerName c2s.dev
ServerAlias *.c2s.dev
</VirtualHost>
And in /etc/hosts I added this:
127.0.1.1 c2s.dev
127.0.1.1 *.c2s.dev
php apache-httpd vhost
add a comment |
up vote
1
down vote
favorite
I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:
Not Found
The requested URL /home was not found on this server.
Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80
(I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:
<VirtualHost 127.0.1.1:80>
DocumentRoot /var/www/c2c/www
ServerName c2s.dev
ServerAlias *.c2s.dev
</VirtualHost>
And in /etc/hosts I added this:
127.0.1.1 c2s.dev
127.0.1.1 *.c2s.dev
php apache-httpd vhost
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:
Not Found
The requested URL /home was not found on this server.
Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80
(I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:
<VirtualHost 127.0.1.1:80>
DocumentRoot /var/www/c2c/www
ServerName c2s.dev
ServerAlias *.c2s.dev
</VirtualHost>
And in /etc/hosts I added this:
127.0.1.1 c2s.dev
127.0.1.1 *.c2s.dev
php apache-httpd vhost
I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:
Not Found
The requested URL /home was not found on this server.
Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80
(I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:
<VirtualHost 127.0.1.1:80>
DocumentRoot /var/www/c2c/www
ServerName c2s.dev
ServerAlias *.c2s.dev
</VirtualHost>
And in /etc/hosts I added this:
127.0.1.1 c2s.dev
127.0.1.1 *.c2s.dev
php apache-httpd vhost
php apache-httpd vhost
edited Nov 25 at 22:49
Rui F Ribeiro
38.3k1477127
38.3k1477127
asked Mar 2 '16 at 12:50
Sasha
11315
11315
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
The official site of Yii explains how to configure vhost for apache. You can see the examples here
For apache basically the configuration is:
<Directory "path/to/basic/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
For you case it could look like this:
<VirtualHost *:80>
ServerName c2s.dev
DocumentRoot /var/www/c2c/www
<Directory /var/www/c2c/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And the file .htaccess on the root web folder like this:
Options +FollowSymLinks
IndexIgnore /
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
</IfModule>
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The official site of Yii explains how to configure vhost for apache. You can see the examples here
For apache basically the configuration is:
<Directory "path/to/basic/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
For you case it could look like this:
<VirtualHost *:80>
ServerName c2s.dev
DocumentRoot /var/www/c2c/www
<Directory /var/www/c2c/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And the file .htaccess on the root web folder like this:
Options +FollowSymLinks
IndexIgnore /
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
</IfModule>
add a comment |
up vote
0
down vote
The official site of Yii explains how to configure vhost for apache. You can see the examples here
For apache basically the configuration is:
<Directory "path/to/basic/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
For you case it could look like this:
<VirtualHost *:80>
ServerName c2s.dev
DocumentRoot /var/www/c2c/www
<Directory /var/www/c2c/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And the file .htaccess on the root web folder like this:
Options +FollowSymLinks
IndexIgnore /
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
</IfModule>
add a comment |
up vote
0
down vote
up vote
0
down vote
The official site of Yii explains how to configure vhost for apache. You can see the examples here
For apache basically the configuration is:
<Directory "path/to/basic/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
For you case it could look like this:
<VirtualHost *:80>
ServerName c2s.dev
DocumentRoot /var/www/c2c/www
<Directory /var/www/c2c/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And the file .htaccess on the root web folder like this:
Options +FollowSymLinks
IndexIgnore /
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
</IfModule>
The official site of Yii explains how to configure vhost for apache. You can see the examples here
For apache basically the configuration is:
<Directory "path/to/basic/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
For you case it could look like this:
<VirtualHost *:80>
ServerName c2s.dev
DocumentRoot /var/www/c2c/www
<Directory /var/www/c2c/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And the file .htaccess on the root web folder like this:
Options +FollowSymLinks
IndexIgnore /
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
</IfModule>
answered Jan 30 '17 at 22:30
Ale
1012
1012
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f267060%2fsetup-vhost-for-subdomain%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown