I have one VMs CentOS inside I have installed drupal and redmine. I did my redmine.conf and drupal.conf. But when I want to open the browser on my I have Bad Gateway error. And I don't understand.
Here my .conf files:
redmine:
LoadModule passenger_module /home/flaman-m/.gem/ruby/gems/passenger-5.0.10/buil$
<IfModule mod_passenger.c>
PassengerRoot /home/flaman-m/.gem/ruby/gems/passenger-5.0.10
PassengerDefaultRuby /usr/bin/ruby
</IfModule>
<VirtualHost *:80>
ServerAdmin morgane
ServerName srvb.quest-etna.nx
DocumentRoot /opt/redmine/public
#PassengerEnabled on
#RailsEnv production
ErrorLog /mnt/nfs/logs/redmine/error.log
CustomLog /mnt/nfs/logs/redmine/access.log combined
<Directory /mnt/nfs/logs/redmine>
DirectoryIndex index.php
Options FollowSymLinks MultiViews
Require all granted
AllowOverride All
Order deny,allow
allow from all
</Directory>
</VirtualHost>
here drupal:
<VirtualHost *:80>
ServerName drupal.flaman-m-quest-etna.nx/
ServerAdmin morganeflamant#gmail.com
DocumentRoot /opt/drupal
DirectoryIndex index.php
ErrorLog /mnt/nfs/logs/drupal/error.log
CustomLog /mnt/nfs/logs/drupal/access.log combined
LogLevel warn
<Directory /mnt/nfs/logs/drupal>
Require all granted
AllowOverride All
Order deny,allow
allow from all
</Directory>
</VirtualHost>
and here my hosts windows :
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.31.138 srva.flaman-m-quest-etna.nx
192.168.31.128 srvb.quest-etna.nx
192.168.31.128 drupal.flaman-m-quest-etna.nx
192.168.31.139 datas.flaman-m-quest-etna.nx
Do you know if something is wrong ? Thank you.
I found it, this is not the best way but I disabled my firewalld in CentOS and it works.
sudo service disable firewalld
sudo service stop firewalld
You can just configure it too to make it works.
Related
I get the below error when I try and setup by wordpress site on Apache, beta.xxx.co.uk. Any ideas? I am expecting to see the wordpress setup wizard but just get an error.
I have:
setup my A record in my DNS under my domain (beta).
created my conf file under sites-available
sudo a2ensite beta.xxxx.co.uk.conf
sudo service apache2 restart
Conf file:
<VirtualHost *:80>
ServerName beta.xxx.co.uk
DocumentRoot /var/www/beta.xxx.co.uk
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/beta.xxx.co.uk/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Host Not Found
DNS error (the host name of the page you are looking for does not exist) or Server did not accept the connection.
Please check that the host name has been spelled correctly.
all I could find is:
<Directory /var/www/beta.xxx.co.uk/>
should propably be:
<Directory /var/www/beta.xxx.co.uk>
Port 80 & 443 is open?
Regards Tom
just before running my site on apache server, site ran properly on django server at port 8000
then i made necessary permssion changes and run the site on apache server
apachectl configtest is ok
Configuration check via
grep -inRH "ServerName " /etc/apache2/ | grep "\s#"*
shows the result give below
/etc/apache2/sites-enabled/site.conf:2: # The ServerName directive sets the request scheme, hostname and port that
/etc/apache2/apache2.conf:56:ServerName localhost
/etc/apache2/sites-available/site.conf:2: # The ServerName directive sets the request scheme, hostname and port that
/etc/apache2/sites-available/000-default.conf:2: # The ServerName directive sets the request scheme, hostname an port that
/etc/apache2/sites-available/000-default.conf:9: #ServerName www.example.com
I tried adding ServerName localhost in site.conf file
but it doesn't seem to work
here is my site.conf code
ServerName localhost
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
Alias /static /home/user/site/static
<Directory /home/user/site/static>
Require all granted
</Directory>
Alias /media /home/usre/site/media
<Directory /home/user/site/media>
Require all granted
</Directory>
<Directory /home/user/site/site>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/user/site/site/wsgi.py
WSGIDaemonProcess django_app python-path=/home/user/site python-home=/home/user/site/venv
WSGIProcessGroup django_app
I am not able to resolve that where the problem is.
Issue: I cannot make the webserver host multiple websites.
Solutions I have tried:
I made two different Vhost.conf for the different websites(named differently according the website name but with the .conf extension. I then targeted different document roots linked to the websites within these config files. – Failed, displayed “connection refused”
I then went to the second website directory I created and change the file permissions to 755 (and 777 just incase) to check if that was conflicting and creating the issue, this also failed and made the same error.
Also all files have “chown -R root:root dir/ “ on.
I then went on to open port 8080 in iptables and changed the targeted port in the vhost of the second website to 8080, this also failed with the same error.
I tried finding the second website using “ip:8080, ip/secondwebsitedirectory, ip:80/secondwebsitedirectory” none of these worked. I followed each step of multiple tutorials online and none of these worked.
When I tested just making a directory and displaying the <?php phpinfo; ?> in index.php within the directory, then targeting that with the document root of the first virtual host block, this worked but did not display the second block’s website (I used the domain to link the alias to this and forwarded the domain to the servers ip).
My current vhost.conf file looks like this **NOTE: I removed ip’s and domains on clients request. They do work and have been tested so that isn’t an issue. Anything with “testsite” was originally the clients domain. **
I have made it two separate VirtualHost blocks previously and had the same result as I am having currently, I have had <VirtualHost *:80> on both blocks too.
<VirtualHost *>
ServerAdmin webmaster#testsite.org
ServerName ea
ServerAlias *server ip was here*
DocumentRoot /var/www/html/ea
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
ServerAdmin webmaster#testsite.org
ServerName testsite
ServerAlias www.testsite.co.uk
DocumentRoot /var/www/html/testsite/public_html
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
The end result I want to come to is to be able to host multiple sites on my cloud server, these website are using Wordpress as that is the development platform I have been instructed to use and the server is running Centos 6.8 with all php and apache2 installed and working on one website.
As to a conclusion to this, I am stumped and need your help.
You need one statment for each site you want
<VirtualHost ea.mydomain.com:80>
ServerAdmin webmaster#testsite.org
ServerName ea.mydomain.com
ServerAlias ea
DocumentRoot /var/www/html/ea
<Directory "/var/www/html/ea/">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
</VirtualHost>
<VirtualHost testsite.mydomain:80>
ServerAdmin webmaster#testsite.org
ServerName testsite.mydomain
ServerAlias testsite.mydomain testsite
DocumentRoot /var/www/html/testsite/public_html
<Directory "/var/www/html/testsite/public_html">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
Been working on a locahost VHost setup for a WordPress Roots development environment with Bedrock including Composer, Capistrano and WP CLI using Homebrew on my OSX Mavericks Mac Mini all morning. I am using Homebrew's PHP 5.5 and MySQL 5.6.19 and OSX's Apache. Thought I had sort of understood Apache VirtualHost inner workings, but I am missing something.
I added img.local to /etc/hosts
127.0.0.1 localhost img.local
255.255.255.255 broadcasthost
::1 localhost img.local
fe80::1%lo0 localhost img.local
and have this in /etc/apache2/extra/httpd-vhosts.conf:
NameVirtualHost *:80
#
# 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>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerAdmin jasper#img.local
DocumentRoot "/Users/jasperfrumau/webdesign/img/web"
ServerName img.local
ServerAlias www.img.local
ErrorLog "/private/var/log/apache2/img.local-error_log"
CustomLog "/private/var/log/apache2/img.local-access_log" common
<Directory "/Users/jasperfrumau/webdesign/img/web/">
Option FollowSymlinks
AllowOverride All
Order allow, deny
allow from all
</Directory>
</VirtualHost>
I restarted the server using apachectl -k restart as root after I checked the config using apachectl -S . It said I was all good:
apachectl -S
VirtualHost configuration:
Syntax OK
When I load img.local in my browser the root localhost is loaded. So either my img.local is still bypassed because of a faulty vhosts file or there is something else in /etc/apache2/httpd.conf I need to change. What am I missing or doing wrong here?
In the end I realised the /etc/apache2/httpd.conf was loading the vhosts from /private/etc/apache2/other/*.conf so I added one img.conf there and restarted the server. There were some errors in the file after all once it was read. This is the correct one:
<VirtualHost *:80>
ServerAdmin jasper#img.local
DocumentRoot "/Users/jasperfrumau/webdesign/img/web"
ServerName img.local
ServerAlias www.img.local
ErrorLog "/private/var/log/apache2/img.local-error_log"
CustomLog "/private/var/log/apache2/img.local-access_log" common
<Directory "/Users/jasperfrumau/webdesign/img/web/">
Options FollowSymlinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I'm developing locally using wamp and i've configured the enviroment to handle more than one site, but i want to access a specific site using an ip address, i don't know if i have to add a port after the 127.0.0.1.
The following are my host settings.
127.0.0.1 localhost
127.0.0.1 www.site1.net
127.0.0.1 www.site3.com
and on vhosts.
<VirtualHost *:80>
ServerAdmin www.site1.net
DocumentRoot "c:/wamp/site1/"
ServerName www.site1.net
ServerAlias www.site1.net
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin www.site2.com
DocumentRoot "c:/wamp/site2/"
ServerName www.site2.com
ServerAlias www.site2.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
Problem
When i put 127.0.0.1 in my address bar it goes to site1, and i don't know how to access site2 using ip.
Why i want this.
Because when i try to access this sites from another device on the same network they don't work unless i use this ip: 172.20.10.4, this on the iphone, and this ip goes to localhost which is site1 and then i can't access site2.
But just www.site.net or www.site2.com works on the machine running wamp.
Edit. This is what is tried.
I put some ports on the 'listen' part of the httpd.confi;
Listen *:80
Listen *:8182
Listen *:8383
And changed htttpd-vhosts;
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot "c:/wamp/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:8181>
ServerAdmin www.site1.net
DocumentRoot "c:/wamp/site1/"
ServerName www.site1.net
ServerAlias www.site1.net
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:8182>
ServerAdmin www.site2.com
DocumentRoot "c:/wamp/site2/"
ServerName www.site2.com
ServerAlias www.site2.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
This works on the devices, like on the iphone i can dial 172.20.10.4:8181 and it goes to site1 and 8182 goes to site two.
NEW PROBLEM
The url of the sites are now messed up, i can only access this sites by their ip with ports but not their domain names, so on the local machine 127.0.0.1:8181 goes to site 1 but www.site1.net doesn't find the server directory where this site is located.
OK
If you use an ip address (from another PC on your network ) and not a url like www.site2.com Apache will not know what site it should run so it always picks the first site it find in the VHost definition file and takes the connection there.
So if you want to access your sites from other PC's on your internal network you either have to run your own DNS Server ( bit complicated ) or on each of the other PC's you need to setup their HOSTS file to know about your 2 sites i.e.
HOSTS FILE ON YOUR OTHER PC's assuming your WAMPSevrer is running on 192.168.1.10
192.168.1.10 www.site1.net
192.168.1.10 www.site2.com
Now these other PC's can use the correct url i.e. www.site1.net or www.site2.com and the Apache server will know which site to send the connection to.
Now I think you mentioned a Phone. This is a little more complex as you cannot get to the HOSTS file on a phone ( possibly you can if you have jailbroken it )
So for this I used a bit of a work around.
I use Fiddler, its a tool for viewing whats going up and down the line between a browser and the server from the PC running the browser.
But you can also use it as a Proxy I think this is the documentation
Basically you set it up to listen for connections on lets say port 8888 and then you add a line to its existing script to tell it to go to a specific url when it sees connections on 8888, you can therefore use a url in the phone like 192.168.1.10:8888 to get to site1.net then change the script so it goes to site2.com
Its a bit conveluted but it worked for me.
Answer to second problem
You dont mention what version of WampServer or Apache you are using so I added a test for the version in the new lines.
You have made a few mistakes in the definition of your virtual hosts. See below for corrections
<VirtualHost *:80>
ServerAdmin me#mysite.net
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "D:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.2 <- change to your subnet first 3 quartiles
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.2 <- ditto
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me#site1.net
DocumentRoot "c:/wamp/www/site1"
ServerName www.site1.net
ServerAlias site1.net
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "D:/wamp/www/site1">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.2 <- change to your subnet first 3 quartiles
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.2 <- ditto
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me#site2.com
DocumentRoot "c:/wamp/www/site2"
ServerName www.site2.com
ServerAlias site2.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "D:/wamp/www/site2">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.2 <- change to your subnet first 3 quartiles
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.2 <- ditto
</IfDefine>
</Directory>
</VirtualHost>
Basically you need to tell each apache which IP's can access each vhosts folder.
So you could keep your modified ports if you wish but keep the <Directory>...</Directory section.
Also check yor HOST file, it was probably a typo when you wrote your question but you have said your hosts file looks like this
127.0.0.1 localhost
127.0.0.1 www.site1.net
127.0.0.1 www.site3.com
It should be this:
127.0.0.1 localhost
127.0.0.1 www.site1.net
127.0.0.1 www.site2.com
it will complicate, please do not use the same server's ip address not or the same server name.. each computer has unique ip, so provide the right ip and do not dupilcate the sitename of your project.. if you have 192.168.1.1 for site1.come then you should use 192.168.1.100 for site2.com.. 127.0.0.1 represents only 1 server ip and 1 sitename only.. please be guided with these difference because calling two persons in one address might result in one and your expecting to have 2 simultiniously.. thanks!