Bonjour,

j'aimerais pouvoir afficher mes sites en cours de développement (en local) sur mon ipad et mon smartphone android. Je suis sous windows 7 et j'utilse WAMP. J'ai déjà paramétré les vhost afin d'avoir des urls perso.

Voici mon fichier host

#Copyright (c) 1993-2009 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 handled within DNS itself.
# 127.0.0.1     localhost
# ::1           localhost

127.0.0.1       localhost
127.0.0.1       monsite

Voici mon fichier httpd-vhosts.conf

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# 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>
    ServerAdmin admin@monsite.com
    DocumentRoot "C:/wamp/www/monsite/"
    ServerName monsite
    ErrorLog "logs/monsite-error.log"
    CustomLog "logs/monsite-access.log" common
    <Directory "C:/wamp/www/monsite/">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

Et voici mon fichier httpd.conf ou j'ai copié collé seulement ce à quoi j'ai touché sinon c'était trop long :p

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

<Directory "c:/wamp/www/">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

La ligne vhost est bien décommentée, j'ai bien activé le rewrite_module.

Donc depuis mon pc, aucun soucis, tout fonctionne niquel, par contre quand je rentre l'adresse ip de mon pc (192.168.1.2) sur mes devices, j'arrive bien à la page d'accueil du localhost de wamp mais quand j'essaye de faire 192.168.1.2/monsite, ça m'affiche "Forbidden, you don't have permission ..."

Si quelqu'un pouvait m'aider ça serait super :)

1 réponse


Cela sert a rien de modifier le fichier host de windows. Le host de windows sert juste a dire que l'ordinateur en question peut pointe vers cette adresse lorsque celui-ci va vers ce faux DNS. Ensuite Apache prend le relais et dit que si une requete vient de cette adresse IP et qu'il possede tel adresse, je le pointe vers tel dossier , le principe du vHost.

Donc c'est le fichier vhost de de ton portable ou de ton Ipad qu'il faut changer. Tu as beau change ton fichier Hsot cela changera rien du tout. Normalement Wamp te permet de visualise ton site depuis l'exterieur dans ces menus. Ou alors tu le configure comme @timotebx l'a dit mais plutot sur ton Apache Wamp (tout les configurations linux sont aussi cnfigurable dans WAMP, il faut aller dans C:/Wamp/...).

Sinon il faut que tu utilise un serveur DNS accessible depuis ton smartphone et ton Ipad.

Si tu es encore une grosse feignasse. Tu peux toujours utiliser l'adresse IP directement ^^.