I am trying to setup WordPress multi site on my ubuntu 10.04 laptop with apache2.
For normal WordPress installs in create an entry in the /etc/hosts file and create virtual hosts entry in /etc/apace2/sites-available directory and then soft link it to sites-enabled directory.
For sub domains, I added the server alias directive. But that is not doing anything. Do I have a syntax error. Please advice.
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName mysite.com
ServerAlias mysite.com *.mysite.com
DocumentRoot /home/myhome/Sites/public_html/mysite.com
#if using awstats
ScriptAlias /awstats/ /usr/lib/cgi-bin/
#we want specific log file for this server
CustomLog /var/log/apache2/example.com-access.log combined
</VirtualHost>
You must restart or reload Apache after making changes to your Apache configuration file. What does it tell you when you run:
sudo /etc/init.d/apache2 restart
Does it show you any error messages? That will tell you if you have a syntax error. For your reference, here is an example of using ServerAlias that I have on my own server. Note the difference between mine and yours. Maybe you should remove the initial mysite.com part and just leave *.mysite.com?
Let me know if that helps.
<VirtualHost *:80>
ServerAdmin jesse#domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/vhosts/domain.com/httpdocs
ServerName domain.com
ErrorLog /var/log/domain.com-error_log
CustomLog /var/log/domain.com-access_log common
</VirtualHost>
Related
Actually, I downloaded PHP7.2.7 safe thread from PHP's website(php.net) and I don't know if it is possible I can configure PHP to setup a virtualhost like we can do using XAMPP
You can try below configuration:
1) Entry in hosts file as below
127.0.0.1 example.com
2) Set virtual host in httpd-vhosts.conf as below
<VirtualHost *:80>
ServerName example.com
DocumentRoot "/var/www/example/public_html"
ServerAlias quickstart.com
<Directory "/var/www/example/public_html">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
PHP has a built-in web server, but is has limited capability. It does not provide all the configuration options a complete web server does. It does not do VirtualHost.
If you need VirtualHost, you will have to include it as a module inside Apache (or other web server). The module will be global. If your pages in a VirtualHost do not need PHP, PHP remains dormant and does nothing.
PHP isn't a web server, you need to create a VirtualHost in Apache. If you're using Linux, open up httpd.conf or /etc/apache2/sites-enabled/000-default.conf
and enter the following lines.
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Make sure to restart your web server/apache in order to these changes to work.
I have a mediawiki site on Ubuntu 14.04, that is working perfectly, and is housed at /var/www/html
I'm trying to get https setup on the server, and I haven't been able to get that done yet. Here's my current port 80 configs, and I'll show what I'm trying below that.
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName mywiki.com
ServerAlias http://mywiki.com
DocumentRoot /var/www/html
</VirtualHost>
/var/www/html/LocalSettings.php
#this is the only relevant line...I think.
$wgServer = "http://mywiki.com"
The changes I'm making, in order, are below
1. Change $wgServer value to //mywiki.com
2. Edit /etc/apache2/sites-available/default-ssl.conf to the following
<VirtualHost _default_:80>
ServerName mywiki.com
Redirect permanent / https://mywiki.com
</VirtualHost>
<VirtualHost _default_:443>
ServerName mywiki.com
ServerAlias https://mywiki.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/my.crt
SSLCertificateKeyFile /etc/apache2/ssl/my.key
</VirtualHost>
3. Stop apache from using the old 000-default.conf file by running sudo a2dissite 000-default.
4. Start using the new ssl default file by running sudo a2ensite default-ssl.
5. Restart Apache2 sudo /etc/init.d/apache2 restart
At this point, apache2 restarts correctly, and there are no errors from the output or in the error.log. However, when I go to the site by typing mywiki.com it doesn't redirect me to https, and now it shows the :80 section of the site as the Index of / html/.
When I try to manually go to https://mywiki.com, I get a page not available, like it's not even trying.
Where am I going wrong?
This was a silly solution, but I imagine on a product like mediawiki, I won't be the last to make this mistake.
I never enabled the ssl module
sudo a2enmod ssl
I went through tens of tutorials on how to setup ssl on mediawiki, and none of them mentioned this. It's pretty obvious if you work on lots of websites, but I don't, and hopefully this helps someone in the future.
You are missing a ServerName. This might be it. Could you attempt this configuration:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mywiki.com
Redirect permanent / https://mywiki.com
</VirtualHost>
<VirtualHost _default_:443>
ServerName mywiki.com
ServerAlias www.mywiki.com
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/my.crt
SSLCertificateKeyFile /etc/apache2/ssl/my.key
</VirtualHost>
I am a complete novice when it comes to WAMP, apache etc.
I'm trying to get a site to run locally but so far not having any luck. I've got as far as installing WAMP and it seems to be going online fine, i.e. the green "W" icon is green. Features like phpmyadmin seems to be working. When I click "localhost" it opens the browsers and navigates to localhost as you'd expect, however, all I see is the directory listing.
So, I have virutal hosts set up as follows:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bts/BiteTheSun"
ServerName bts
ServerAlias bts
<Directory "c:/wamp/www/bts/BiteTheSun">
Require all granted
</Directory>
</VirtualHost>
and in my hosts file I have:
127.0.0.1 localhost
127.0.0.1 bts
::1 bts
::1 localhost
I've added some images just to be clear as to the issue - the top image shows what I think I should be seeing and the bottom shows what I actually see:
localhost screenshot issue
I've tried everything I can think of to no avail. It might also help to mention that in the log file [apache_error.log] I seem to get errors relating to permissions:
"AH01630: client denied by server configuration: C:/Apache24, referer: http://localhost/"
However, I've gone through the permissions set in the config files using examples from several sources and nothing seems amiss.
Has anyone any idea what is going on here? I have searched online high and low on this and on one else seems to have exactly this issue which makes me think it is me doing something very silly - I just need someone to point out how exactly! :)
Richard
Is there an index file in your www folder?
Typically, you want to place your individual projects within the www folder and point your virtual hosts to the www/your-project/ folder which should contain an index.php file (unless you have a custom set up where you are going to point your virtual host directly to a specific file).
Your Virtual Host definitions are incomplete.
Each VH should have its own <Directory>...</Directory> definitions so you can apply the access and other config information to that directory.
The parts you are missing are AllowOverride and Options.
The other thing to remember is that when you create a Virtual Host environment the host defined in the httpd.conf file is basically ignored and the VH's take presidence. This is why you need to redefine the localhost in the VH file.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bts/BiteTheSun"
ServerName bts
<Directory "c:/wamp/www/bts/BiteTheSun">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
Your AH01630: client denied by server configuration: C:/Apache24 error is likely because the default httpd-vhost.conf file comes with 2 example definitions as supplied by Apache. These should be completely deleted from the file. So if you left these in the httpd-vhost.conf file. Delete them completely from the file.
Example of the defs to remove. Note they use the c:/Apache24 directory which does not, and should not exist in a WAMPServer environmant!
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
So I have www.example.com and m.example.com. Now when I go to m.example.com I see the same content as www.example.com. I have an index.php inside the m.example.com, so I'd expect that to show instead.
Here's my m.website.com.conf
<VirtualHost *:80>
ServerName m.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/m/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And a part of my apache2.conf
<VirtualHost *:80>
ServerAdmin web#webite.com
DocumentRoot /var/www/m
ServerName m.example.com
ErrorLog /var/log/apache2/mlog.log
</VirtualHost>
So now I'd expect it to work off of /var/www/m, and inside that I have a separate file that isn't rendering, because the main domain takes it over. Any help would be great.
For adding virtual hosts to your Apache use this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-debian-7
It's my first time seeing someone that puts virtualhost information on 2 files, both at the apache2.conf and at the sites-available folder. In my setup, I have an "include" statement in my apache2.conf file which includes the files in the sites-enabled directory and not other information at all - this is the default for Debian Linux, I didn't touched it at all. I put all my virtualhost configurations in the sites-available directory. That's where you should put them also.
I have installed wamp a handful of times, and have it working on my local environment. Currently I am attempting to resolve an issue on a server of mine which is running wamp. I uninstalled a working copy, and now when I attempted to reinstall I have been unsuccessful. I have changed the port to be 8080 and have configured the httpf.config to do so.
ServerName 50.56.176.95:8080
ServerRoot "C:/wamp/bin/apache/apache2.4.9"
Listen 50.56.176.95:8080
<virtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName 50.56.176.95
</virtualHost>
<virtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName 50.56.176.95
<directory "c:/wamp/www/Hi">
Order allow,deny
Allow from all
Require all granted
</directory>
</virtualHost>
Wamp turns on and apache and php start up, however if I attempt o access 50.56.176.96:8080 I will get a 404 error.
Something to note is that everything is commented out in the htacces file in the www directory.
Should the ServerName not actually be a name and not an ip address?
Also you are using Apache 2.2 and Apache 2.4 access control syntax in the same VH def? As you are using Apache 2.4 it may be best to stick to 2.4 syntax.
So maybe this will work :-
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName hi.com
ServerAlias www.hi.com
<Directory "c:/wamp/www/Hi">
Require all granted
</Directory>
</VirtualHost>