Can anybody help me in creating subdoain through webmin. I want to create subdomain like test.xxxxx.com for this I tried with several reference site but no luck.
exp.
http://www.trickylinux.net/add-domain-virtualminwebmin.html
http://codeboxlabs.com/add-subdomain-webmin-linux/
My current httpd.conf look like:
<VirtualHost *:80>
SSLEngine off
DocumentRoot /var/www/html/******/web
DirectoryIndex index.php
<Directory "/var/www/html/*****/web">
AllowOverride All
Allow from All
</Directory>
ServerName www.******.com
ServerAlias ftp.*****.com
SSLEngine off
SSLVerifyClient optional
</VirtualHost>
Please help me to solve this issue.
I know its been a year and you must have found a path already but its for the future reference.
Just add another host:
<VirtualHost *:80>
DocumentRoot /var/www/html/******/subdomain
DirectoryIndex index.php
<Directory "/var/www/html/*****/subdomain">
AllowOverride All
Allow from All
</Directory>
ServerName www.subdomain.******.com
ServerAlias subdomain.******.com
SSLEngine off
SSLVerifyClient optional
</VirtualHost>
Of course restarting apache is needed in order to make it read the new VHost
What you need to do next is add an A record in you domain registrar (i.e, Godaddy). Record name will be your "subdomain" and it'll point to your server address:
A-----------------> # --------------------> ******.com
A-----------------> ******.com------------> ******.com
A-----------------> subdomian.******.com--> ******.com
Related
I have been working on this for a while, and I am trying to use .htaccess and .htpasswd. Here is what I have done:
Performed with Apache using Raspberry Pi 3B+ with DietPi installed.
I created a new .htpasswd file and proceeded to enter password that I wanted.
Next, I redirected to /etc/apache2/sites-enabled/ where I edited 000-default.conf and changed the line of code:
<VirtualHost *80>
ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/etc/"
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^https://%{SERVER_NAME%{REQUEST_URI} [END,Ne,R=permanent]
</VirtualHost>
Everything here is the same, except replace "example" with my domain.
This did not affect my site, so I redirected to /etc/apache2/ where I edited apache2.conf and added the line of code:
<Directory /var/www/etc/>
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
</Directory>
Once again, everything here is the same. etc is the file that I want to password-protect. This made the page that I wanted to protect completely inaccessible, and when I changed AllowOverride and Require all it just made the page completely open. How can I make it so that a password is prompted when you try to access the directory?
When attempting to access a website i am attempting to host on my pc using WAMP i get the typical error code 403 forbidden. I have edited the apache config to allow all etc but still seem to get it, however i can see localhost and phpadmin from 127.0.0.1
Any other suggestions? i can attach my apache config or put it in a pastebin if needed
For reference im running Win10(64x) with WAMP Server 3.0.6 (64x)
I have followed multiple tutorials from youtube and stackoverflow but cannot seem to get it to work as most use commands given are from linux such as 'chmd' (i have used linux before therefor understand what this means but cant work out how to do the same thing via windows)
Try making virtual host and give access to all local user. Make sure you give access to
file -------> httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
#onlineoffline tag - don't remove
Require local
Require ip 192.168.0
</Directory>
Edit httpd-vhosts.conf As like:
file ------> httpd-vhosts.conf
# Virtual Hosts
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName smarthome
DocumentRoot "c:/wamp64/www/smarthome"
<Directory "c:/wamp64/www/smarthome/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Hi to everyone I have two different sites and I want to two different host:
movie.local
music.local
These are my files:
#
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 movie.local
127.0.0.1 music.local
And
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName movie.local
ServerAlias www.movie.local
DocumentRoot "/Users/Me/Sites/movie"
ErrorLog "/private/var/log/apache2/site-error_log"
CustomLog "/private/var/log/apache2/site-access_log" common
ServerAdmin neilgee#coolestguidesontheplanet.com
<Directory "/Users/Me/Sites/movie">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName music.local
ServerAlias www.music.local
DocumentRoot "/Users/Me/Sites/music"
ErrorLog "/private/var/log/apache2/site-error_log"
CustomLog "/private/var/log/apache2/site-access_log" common
ServerAdmin neilgee#coolestguidesontheplanet.com
<Directory "/Users/Me/Sites/music">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
But now if I go to movie.local that's ok, but if i go to music.local my browser will load the content of movie.local, why?
if i go to music.local my browser will load the content of movie.local, why?
You can create a subdomain on your localhost like this.
First create a virtual host:
<VirtualHost *:80>
ServerName music.localhost
DocumentRoot "C:/Users/Me/Sites/music"
<Directory "C:/Users/Me/Sites/music">
/....../
/....../
</Directory>
</VirtualHost>
And in your hosts file add this line:
127.0.0.1 music.localhost
How i can correctly direct multiple url in a same conf file.let me know if i am correct to put my conf file like this
<VirtualHost *:80>
ServerName domain1.com
ServerAlias domain2.com
... real vhost settings ...
</VirtualHost>
and what if user could'nt find the url then he should me directed to a default page.please if anyone can tell me how i can put a redirection to a defult only if that url is not found.
You can set up apache vhosts like this:
<VirtualHost *:80>
ServerName domain1.com
ServerAlias *.domain1.com
ServerAlias domain2.com
ErrorDocument 404 /errors/error404.php
#... real vhost settings ...
</VirtualHost>
Any not found URL will be redirected to /errors/error404.php, or any URL you give here.
Ref http://en.wikipedia.org/wiki/HTTP_404.
For ServerAlias domain2.com, you must set up first a bind primary zone for this domain in your name server, this cname will point to your server's IP, otherwise, this line will have no effect.
I got this error :
Warning: PDO::__construct() [<a href='pdo.--construct'>pdo.--construct</a>]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (trying to connect via tcp://1:3306) in Z:\work\...
My localhost/phpmyadmin works fine but I can't access localhost or 127.0.0.1 , I get a blank page with "Forbidden : You don't have permission to access / on this server."
I have nothing else running on my port 80
I modified my httpd.conf
DocumentRoot "z:/work/"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "z:/work/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
Also added in my httpd-vhosts.conf
<Directory C:/Users/Alex/Documents/GitHub>
Order Deny,Allow
Allow from all
AllowOverride All
</Directory>
<Directory Z:/work>
Order Deny,Allow
Allow from all
AllowOverride All
</Directory>
<VirtualHost *:80>
DocumentRoot "Z:\work\mysite"
ServerName bullseye.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\Alex\Documents\GitHub\Myproject"
ServerName framework.local
</VirtualHost>
And my phpmyadmin.conf is as follow
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin3.5.1/"
<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
The code giving the error :
$host = 'localhost';
$user = 'root';
$pass = '';
$database = 'mydatabase';
$this->db = new PDO('mysql:dbname=' . $database . ';host=' .$host . ';charset=utf8', $user, $pass);
I get the same error using mysql or msqli instead of PDO
My suggestion would be to:
Undo all your changes to httpd.conf. Your changes have removed all knowledge Apache has of the WAMP homepage i.e. localhost.
Comment out the include of the virtual hosts config and check you can again access the WAMP homepage.
Make sure that WAMP is 'OffLine', this will keep the C:\ drive and c:\wamp folder secure.
Now to your Virtual hosts definitions:
In order to keep the wamp homepage working the first entry should be as below, note the Directory block should be part of the definition of the VirtualHost and the security definition makes sure you can only access the wamp homepage from 127.0.0.1(localhost)
###must be first so the the wamp menu page loads
<VirtualHost *:80>
ServerAdmin webmaster#homemail.net
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "D:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
Each VHOST you define should contain its own security settings like this
<VirtualHost *:80>
DocumentRoot "Z:\work\mysite"
ServerName bullseye.local
ServerAlias bullseye.local
AllowOverride All
<Directory "Z:\work\mysite">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\Alex\Documents\GitHub\Myproject"
ServerName framework.local
ServerAlias www.framework.local
<Directory "C:\Users\Alex\Documents\GitHub\Myproject">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Uncomment the Include in https.conf for your vhosts definitions and try accessing you other projects again.
I assume you have made the required changes to your c:\windows\system32\drivers\etc\hosts file to include a reference to all you virtual hosts? If not the hosts file should look like this :-
127.0.0.1 localhost
127.0.0.1 framework.local
127.0.0.1 bullseye.local
My concern is this:
DocumentRoot "z:/work/"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "z:/work/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
Unfortunately I don't have time to test this before I suggest it... but if DocumentRoot is z:/work/ then Directory / is also z:/work/ and you have set that to deny all and override none. Later trying to change the permission with Directory "z:/work/" would be considered an override and therefore not be applied? I suggest you try changing the AllowOverride to all or removing the deny all from / before you spend too much time hunting down other possible solutions.