I'm currently using name-based virtual host configuration /conf/extra/httpd-vhosts.conf in apache to serve few different websites from the same IP address, just like in the apache documentation.
<VirtualHost *:80>
ServerName domain1.example.com
DocumentRoot /www/domain1
</VirtualHost>
<VirtualHost *:80>
ServerName domain2.example.com
DocumentRoot /www/domain2
</VirtualHost>
If I try to open a web site, that is configured in /conf/httpd.conf, defined by directive ServerName, which is basically FQDN of Linux server, I'm getting the very 1st page defined in /conf/extra/httpd-vhosts.conf - apache is acting that DNS name does not match any ServerName defined, therefore I'm getting the 1st one from /conf/extra/httpd-vhosts.conf.
If I change the directive Listen in /conf/httpd.conf to a different port (from that defined in /conf/extra/httpd-vhosts.conf; I'm using standard port 80) and then try to hit http://ServerName:Port (Port defined in Listen - I used 8000 for testing purpose), I'm getting content of web site configured in /conf/httpd.conf (ServerRoot), which is what I want.
I tried to change the port defined in /conf/extra/httpd-vhosts.conf to match it with that one temporary configured in /conf/httpd.conf e.g.:
<VirtualHost *:8000>
ServerName domain1.example.com
DocumentRoot /www/domain1
</VirtualHost>
<VirtualHost *:8000>
ServerName domain2.example.com
DocumentRoot /www/domain2
</VirtualHost>
Now, when I hit http://ServerName:Port (port = 8000), apache again gives me 1st web site from /conf/extra/httpd-vhosts.conf - domain1.example.com
I tried to update directives Listen (in /conf/httpd.conf) with server IP, IP:port but it does not work either.
My server has DNS A record, web sites in /conf/extra/httpd-vhosts.conf are configured in DNS as ALIAS records for server A record.
EDIT:
Adding ouput of apachectl -S:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server domain1.example.com (/appl/apache24/conf/extra/httpd-vhosts.conf:24)
port 80 namevhost domain1.example.com (/appl/apache24/conf/extra/httpd-vhosts.conf:24)
alias domain1.example.com
port 80 namevhost domain2.example.com (/appl/apache24/conf/extra/httpd-vhosts.conf:38)
alias domain2.example.com
ServerRoot: "/appl/apache24"
Main DocumentRoot: "/appl/apache24/htdocs"
Main ErrorLog: "|/appl/apache24/bin/rotatelogs /appl/apache24/logs/admin-error_log.%Y%m%d 86400"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/appl/apache24/logs/" mechanism=default
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/appl/apache24/logs/httpd.pid"
EDIT2:
Adding output of apachectl -V:
Server version: Apache/2.4.23 (Unix)
Server built: Sep 21 2016 11:23:28
Server's Module Magic Number: 20120211:61
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/opt/app/workload/apache24"
-D SUEXEC_BIN="/opt/app/workload/apache24/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
Related
I've recently updated my setup from Debian 10 (Buster) to Debian 11 (Bullseye) and have Gitlab-CE installed.
I'm using Apache instead of Nginx as the system is being used as a website development server which is making use of port 80 and 443.
On my Debian 10 setup I was able to access Gitlab through a proxy / reverse proxy on a subdomain e.g. "git.example.com"
settings can be found below.
However in Debian 11 with the same configuration and setup, I am faced with an error 404 response.
Issue | Error Message
"404 : The page could not be found or you don't have permission to view it."
Image of Error Message:
https://aws1.discourse-cdn.com/business4/uploads/gitlab/original/3X/c/2/c2879ede19d693d0eb4032fd9a6a1f192bcddb97.png
Information
Notes:
System is running in Oracle Virtual Machine: Virtual Box
Example.com is used in place of my DNS / domain
Setup uses Subdomain access
GitLab has been configured with the use of Apache2 instead of Nginx
Docker is NOT being used.
Port Forwarding has been configured (Router, VM and UFW Firewall)
Image of UFW settings: https://aws1.discourse-cdn.com/business4/uploads/gitlab/original/3X/d/a/daac2a6b30f519272d7b358a4089675aab905588.png
Apache2 Modules
headers
rewrite
ssl
proxy
proxy_http
Installation
Gitlab-CE Packages
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
Gitlab.rb
nano /etc/gitlab/gitlab.rb
## Set Url
external_url "https://gitlab.example.com"
## Give apache user privileges to listen to gitLab
web_server['external_users'] = ['www-data']
web_server['username'] = 'apache' # updated: apache, default: gitlab-www
web_server['group'] = 'apache' # updated: apache, default: gitlab-www
## Disable nginx
nginx['enable'] = false
## Config network
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_umask'] = 0
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
gitlab_workhorse['auth_backend'] = "http://127.0.0.1:8080"
# Puma
puma['listen'] = '127.0.0.1'
puma['port'] = 8080
Apache Http.conf
nano /etc/apache2/sites-available/http.conf
<VirtualHost *:80>
ServerName git.example.com
ServerSignature Off
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L]
</VirtualHost>
Apache Https.conf
nano /etc/apache2/sites-available/https.conf
certbot --apache
<IfModule mod_ssl.c>
<VirtualHost *:443>
# Server
ServerName git.example.com
ServerSignature Off
ProxyPreserveHost On
# Ensure that encoded slashes are not decoded but left in their encoded state.
# http://doc.gitlab.com/ce/api/projects.html#get-single-project
AllowEncodedSlashes NoDecode
<Location />
# New authorization commands for apache 2.4 and up
# http://httpd.apache.org/docs/2.4/upgrading.html#access
Require all granted
# Allow forwarding to gitlab-workhorse
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://git.example.com
</Location>
# Apache equivalent of nginx try files
# http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
# http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
RewriteEngine on
# Forward all requests to gitlab-workhorse except existing files like error documents
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
RequestHeader set X_FORWARDED_PROTO 'https'
RequestHeader set X-Forwarded-Ssl on
# Needed for downloading attachments
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
#Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html
# The default directory log is usually /var/log/httpd
# As this is an Apache2 configuration, use of ${APACHE_LOG_DIR} may be more approrpaite
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog ${APACHE_LOG_DIR}/git.example.com_error.log
CustomLog ${APACHE_LOG_DIR}/git.example.com_forwarded.log common_forwarded
CustomLog ${APACHE_LOG_DIR}/git.example.com_access.log combined env=!dontlog
CustomLog ${APACHE_LOG_DIR}/git.example.com.log combined
# SSL
# Use strong encryption ciphers only
# See ciphers(1) http://www.openssl.org/docs/apps/ciphers.html
SSLEngine on
SSLProtocol all -SSLv2
SSLHonorCipherOrder on
SSLCipherSuite "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS"
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
SSLCompression Off
SSLCertificateFile /etc/letsencrypt/live/git.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/git.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
System & Gitlab
gitlab-rake gitlab:env:info
System: Debian 11
Current User: git
Using RVM: no
Ruby Version: 2.7.5p203
Gem Version: 3.1.4
Bundler Version:2.2.33
Rake Version: 13.0.6
Redis Version: 6.2.6
Sidekiq Version:6.4.0
Go Version: unknown
GitLab information
Version: 14.10.0
Revision: 88da5554d96
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.7
URL: https://git.example.com
HTTP Clone URL: https://git.example.com/some-group/some-project.git
SSH Clone URL: git#git.example.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 13.25.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Gitlab Status
service gitlab-runsvdir status
gitlab-runsvdir.service - GitLab Runit supervision process
Loaded: loaded (/lib/systemd/system/gitlab-runsvdir.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-05-01 16:48:52 BST; 40min ago
Main PID: 1786 (runsvdir)
Tasks: 304 (limit: 4915)
Memory: 2.8G
CPU: 43min 49.508s
CGroup: /system.slice/gitlab-runsvdir.service
├─1786 runsvdir -P /opt/gitlab/service log: ..............................................................>
├─1788 runsv node-exporter
├─1789 runsv grafana
├─1790 runsv gitlab-workhorse
├─1791 runsv sidekiq
├─1792 runsv gitlab-kas
├─1793 runsv puma
├─1794 runsv prometheus
├─1795 runsv redis
├─1796 runsv postgresql
├─1797 runsv postgres-exporter
├─1798 runsv logrotate
├─1799 runsv redis-exporter
├─1800 runsv alertmanager
├─1801 runsv gitlab-exporter
├─1802 runsv gitaly
├─1803 svlogd -tt /var/log/gitlab/node-exporter
├─1804 svlogd -tt /var/log/gitlab/prometheus
├─1805 svlogd /var/log/gitlab/gitlab-workhorse
├─1806 svlogd -tt /var/log/gitlab/gitlab-kas
├─1807 svlogd -tt /var/log/gitlab/puma
├─1808 svlogd -tt /var/log/gitlab/redis
├─1809 svlogd /var/log/gitlab/sidekiq
├─1810 svlogd -tt /var/log/gitlab/logrotate
├─1811 /opt/gitlab/embedded/bin/node_exporter --web.listen-address=localhost:9100 --collector.mountstats ->
├─1812 svlogd -tt /var/log/gitlab/grafana
├─1813 svlogd -tt /var/log/gitlab/gitlab-exporter
├─1814 svlogd -tt /var/log/gitlab/postgresql
├─1815 svlogd -tt /var/log/gitlab/redis-exporter
├─1816 svlogd -tt /var/log/gitlab/alertmanager
├─1817 svlogd -tt /var/log/gitlab/postgres-exporter
├─1818 svlogd /var/log/gitlab/gitaly
├─1819 /opt/gitlab/embedded/bin/prometheus --web.listen-address=localhost:9090 --storage.tsdb.path=/var/op>
├─1820 /opt/gitlab/embedded/bin/gitlab-workhorse -listenNetwork tcp -listenUmask 0 -listenAddr localhost:8>
├─1821 /opt/gitlab/embedded/bin/gitlab-kas --configuration-file /var/opt/gitlab/gitlab-kas/gitlab-kas-conf>
├─1823 /bin/sh /opt/gitlab/embedded/bin/gitlab-logrotate-wrapper
├─1824 /opt/gitlab/embedded/bin/redis-server unixsocket:/var/opt/gitlab/redis/redis.socket
├─1825 ruby /opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster -e production -r /opt/gitlab/emb>
├─1833 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
├─1834 /opt/gitlab/embedded/bin/redis_exporter --web.listen-address=localhost:9121 --redis.addr=unix:///va>
├─1835 /opt/gitlab/embedded/bin/alertmanager --web.listen-address=localhost:9093 --storage.path=/var/opt/g>
lines 1-49
Debugging
As this is system running in a VM, I've made restore points to recover the VM and rollback if necessary.
Attempts made
Change folder permissions and ownership of gitlab.rb & /opt/gitlab/embedded/service/gitlab-rails/public
Checked examples of Apache Configurations from various sources
Cleared Cache / Cookies in browser
Used other browsers to attempt loading
Tried loading Gitlab through localhost on Debian server directly "same result as accessing via git.example.com"
Updating and Upgrading packages
I need help configuring my website to be accessed in the local server as a virtual directory in Apache.
I am trying to use the port 8050, and when i open localhost:8050 , it shows:
This site can’t be reached
localhost refused to connect. ERR_CONNECTION_REFUSED
when i try to access my localhost:80 in the browser, it shows the default blank page with the message "It Works"
if i change my virtualhost to *.80 in the config, it keeps showing the default message "It Works", instead of my page.
apachectl -t returns Syntax OK
the command:
apachectl -t -D DUMP_VHOSTS returns:
VirtualHost configuration:
*:8050 personal.com (/private/etc/apache2/extra/httpd-vhosts.conf:24)
the Servername in my httpd.conf file is localhost, and it also contains:
Listen 8050
and
Listen localhost:8050
this is my httpd-vhosts in etc/apache2/extra/httpd-vhosts.conf:
<VirtualHost *:8050>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Users/renatobento/Documents/Projetos/Personal"
ServerName personal.com
ErrorLog "/private/var/log/apache2/personal.com-error_log"
CustomLog "/private/var/log/apache2/personal.com-access_log" common
<Directory "/Users/renatobento/Documents/Projetos/Personal">
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
The path "/Users/renatobento/Documents/Projetos/Personal" seems correct, and contains a simple index.html with some content, which works in the browser with file protocol: "file:///Users/renatobento/Documents/Projetos/personal/index.html"
Already executed
apachectl stop , apachectl start , and apachectl restart thousand times
after the stop command, the localhost:80 still shows the message "It Works"
I am using MAC OSX 10.3 high sierra, apache 2.4
Server version: Apache/2.4.33 (Unix) Server built: Apr 3 2018
23:45:11 Server's Module Magic Number: 20120211:76 Server loaded: APR
1.5.2, APR-UTIL 1.5.4 Compiled using: APR 1.5.2, APR-UTIL 1.5.4 Architecture: 64-bit Server MPM: prefork threaded: no
forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_FLOCK_SERIALIZE -D
APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D
APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D
DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr" -D
SUEXEC_BIN="/usr/bin/suexec" -D
DEFAULT_PIDLOG="/private/var/run/httpd.pid" -D
DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D
DEFAULT_ERRORLOG="logs/error_log" -D
AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types" -D
SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
edit:
tried with a different port :9050 but still not working
Check whether permissions for DocumentRoot
/Users/renatobento/Documents/Projetos/Personal
are set to be accessible for everyone.
Your overall config seems to be good.
Check your /etc/hosts file, if it contains something like
127.0.0.1 localhost
127.0.0.1 personal.com
To edit this file, type sudo nano /etc/hosts in Terminal and after editing, type sudo killall -HUP mDNSResponder to flush DNS cache.
Problem solved.
Weird, looks like restarting Apache and cache commands sometimes are not enough.
The message changed to 403-forbidden after a system restart.
I checked the ports with
lsof -nP -i4TCP:80 | grep LISTEN
lsof -nP -i4TCP:8050 | grep LISTEN
lsof -nP -i4TCP:9050 | grep LISTEN
and it showed 4 httpd process listening to :80 even with apache stopped, then after a reboot appeared a process listening in the correct port.
I have phpList already setup and Codeigniter project that I want to add in one server.
The phpList configuration which is located /etc/httpd/conf.d/phplist.conf has:
<VirtualHost *:80>
ServerName phplist.example.com
ServerAdmin admin#example.com
DocumentRoot /var/www/phplist-3.0.5/public_html
LogLevel warn
ErrorLog /var/log/httpd/phplist_error.log
CustomLog /var/log/httpd/phplist_access.log combined
</VirtualHost>
Here is my possible setting for the CI project, but I don't know how to create one.
<VirtualHost *:80>
ServerName listcsv.com
ServerAdmin admin#listcsv.com
DocumentRoot /var/www/citest/index.php
</VirtualHost>
Below the /etc/httpd/conf/httpd.conf file has a IncludeOptional conf.d/*.conf so I think this would include the configuration file on phplist.
I don't know what settings and where configuration file should I go,
should I edit on /etc/httpd/conf/httpd.conf or just add it together with the phpList configuration at /etc/httpd/conf.d/phplist.conf?
I tried accessing phplist at http://phplist.example.com but the site cannot be reached.
I could access the phpList by going to http://server-ip-address/lists/admin on the browser.
Also, I cannot access the CI project.
I would recommend creating the directory that the virtual hosts will be stored in, as well as the directory that tells Apache that a virtual host is ready to serve the website
sudo mkdir /etc/httpd/sites-available # vhost files
sudo mkdir /etc/httpd/sites-enabled # symbolic links for vhost enabled
Tell Apache where to look for virtual hosts
sudo vim /etc/httpd/conf/httpd.conf
Add this line at the end of the file
IncludeOptional sites-enabled/*.conf
Save and exit.
For each website/domain create its own vhost
sudo vim /etc/httpd/sites-available/example1.com.conf
sudo vim /etc/httpd/sites-available/example2.com.conf
sudo vim /etc/httpd/sites-available/example3.com.conf
Enable the virtualhost
sudo ln -s /etc/httpd/sites-available/example1.com.conf /etc/httpd/sites-enabled/example1.com.conf
sudo ln -s /etc/httpd/sites-available/example2.com.conf /etc/httpd/sites-enabled/example2.com.conf
sudo ln -s /etc/httpd/sites-available/example3.com.conf /etc/httpd/sites-enabled/example3.com.conf
We done, restart your Apache server for the changes to take affect
sudo apachectl restart
Don't forget to point your domains to the web server's public IP address.
I am trying to add a vhost for a specific project located within my MAMP htdocs folder.
Steps I did:
Open /Applications/MAMP/htdocs/conf/apache/httpd.conf and uncomment the Include /Applications/MAMP/htdocs/conf/apache/extra/httpd-vhosts.conf line.
Open /Applications/MAMP/htdocs/conf/apache/extra/httpd-vhosts.conf and removed both demo vhosts, and added the following:
<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/arko/Sites/mysite"
ServerName mysite
</VirtualHost>
Edit hosts file: sudo vim /etc/hosts and added this line:
127.0.0.1 mysite
My hosts file now looks like this:
##
# 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
# MAMP Virtual Hosts
127.0.0.1 mysite
Then I opened up my MAMP and restarted the servers (stop servers, then started servers).
Whenever I go to http://mysite/ I just get the contents of /Applications/MAMP/htdocs (a ugly list of all my folders in there, since I have no index file in my htdocs folder.
So it seems like it is ignoring my vhost, and just using my hosts file to route http://mysite/ to 127.0.0.1 (localhost)
Update
When I go to http://mysite/ I get this error in my apache error log:
[Wed Mar 16 11:04:39 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
Take a look at this. I think apatch is hosting the .DS_STORE file.
link
I desesperate to get wamp working!
I've installed wampserver 2.5 on my win7 64bits machine.
In the httdp.conf file, I just commented out the line regarding vhosts:
Include conf/extra/httpd-vhosts.conf
The httpd-vhosts.conf contains:
<VirtualHost *:80>
DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"
ServerName petsy.dev
ServerAlias www.petsy.dev
<Directory "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<RequireAny>
Require local
Require ip 192.168.1
</RequireAny>
</Directory>
</VirtualHost>
(I also tried Require all granted)
I first installed wampserver 2.5 64 bits.
I was able, from my local machine to access http://petsy.dev
But when I tried to access to http://192.168.1.16/petsy.dev from an other machine of my LAN, I was always getting a 403 error (Forbidden):
[Thu Dec 04 14:43:08.519329 2014] [authz_core:error] [pid 11088:tid 776] [client 192.168.1.15:39975] AH01630: client denied by server configuration: C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev
[Thu Dec 04 14:43:08.635335 2014] [authz_core:error] [pid 11088:tid 776] [client 192.168.1.15:39975] AH01630: client denied by server configuration: C:/wamp/www/favicon.ico
I got access remotely to petsy.dev when I added in the remote PC hosts file the line:
192.168.1.16 petsy.dev
In that case, I was able, on my remote machine, to access to the server using 'http://petsy.dev'.
First I don't understand what does it change on the server side and secondly I cannot be satisfied by this solution as I cannot use it on a smartphone.
As I wasn't able to find an answer anywhere, I finally tried to install wampserver 2.5 32 bits!
Same problem! But with a different error:
I can ALWAYS access to my petsy.dev website locally but now, when I try to access it remotely, I get a 404 error (not Found) !!!
Here are the access logs of apache
From my local machine:
xxxx::7d1a:xxxx:9672:xxxx - - [05/Dec/2014:19:22:25 +0100] "GET / HTTP/1.1" 200 40438
From my remote machine:
192.168.1.15 - - [05/Dec/2014:19:22:30 +0100] "GET /petsy.dev/ HTTP/1.1" 404 295
httpd -T answers syntax OK
httpd -S says:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:23)
port 80 namevhost localhost (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:23)
alias localhost
port 80 namevhost petsy.dev (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:34)
alias www.petsy.dev
ServerRoot: "C:/wamp/bin/apache/apache2.4.9"
Main DocumentRoot: "C:/wamp/www/"
Main ErrorLog: "C:/wamp/logs/apache_error.log"
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex default: dir="C:/wamp/bin/apache/apache2.4.9/logs/" mechanism=default
Mutex authdigest-opaque: using_defaults
PidFile: "C:/wamp/bin/apache/apache2.4.9/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: APACHE24=Apache2.4
Please, please which stupid error did I make ????
You dont need the <RequireAny> so just try this
<VirtualHost *:80>
DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"
ServerName petsy.dev
ServerAlias www.petsy.dev
<Directory "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
Require ip 192.168.1
</Directory>
</VirtualHost>
Additional Info
I dont think you understand what is happening when you create Virtual Hosts.
Basically when Apache see's it has one or more Virtual Hosts configured, you are teling Apache that it is the server for more than one domain name. The important part in that sentence is more than one domain name.
This causes Apache to examine the domain name on each incoming connection. It will then match the domain name to one of its Virtual Hosts definitions and change the DocumentRoot and potentially other parameters to those set in that Virtual Host.
So the important thing is that you use a matching domain name in the browser of the other PC you are using to get to Apache with a domain name it knows about.
This would normally be done by a DNS Server on the real internet, but while you are inside your own local network i.e. safely behind your router you have to use another method. You could setup your own local DNS Server, but thats quite complicated.
So the simple solution is to use the HOSTS file on the other PC's in your network.
So on the other PC (not the PC running WAMPServer), edit the \windows\system32\drivers\etc\hosts file and add this
192.168.1.16 petsy.dev
Then either reboot or do this to reload the windows dnscache
Start a command windows using "Run as Administrator" and execute these 2 commands to reload the cache
net stop dnscache
net start dnscache
Now you can use the correct domain name from the browser on the non-wampserver pc like so
http://petsy.dev
And the browser will find that petsy.dev lives on ip address 192.168.1.16. When the connection is made with 192.168.1.16 it will be using the corretc domain name i.e. petsy.dev and apache will find the virtual host and set everything as per the VH config and server pages from the correct folder.
here is a great tutorial
Project Links do not work on Wamp Server
Answer #1 worked for me
I'm running windows 7 64 bit
I have wampserver2.5 (64 bit) installed on a hd assigned to letter A
All my dev sites are located on A:\websites
In A:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf I have this
<VirtualHost *:80>
DocumentRoot "A:/websites"
ServerName localhost
ServerAlias localhost
<Directory "A:/websites">
AllowOverride All
Require local
</Directory>
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "A:/websites/example.dev/www
ServerName example.dev
ServerAlias www.example.dev
<Directory "A:/websites/example.dev/www>
AllowOverride All
Require local
Require ip 192.168.10
</Directory>
</VirtualHost>
On the computer running wamp I adjusted the host file as follows
127.0.0.1 example.dev
::1 example.dev
On the local remote computer I've added an entry to the host file as
192.168.10.100 example.dev (this is the ip address of the computer running wamp)
next step is to clear your dns cache
open a terminal on the windows box that's not the web server
type "net stop dnscache"
type "net start dnscache"
Open a browser and point it to example.dev and it works
hope this helps