Accessing local Wordpress site within the network using WAMP? - wordpress

Allright this driving me nuts! I have spent couple of hours trying to find a solution of how to access my Wordpress site from outside my network, when no easy solution was found I'm OK with just being able to accessing it from another device within my network. It turned out to be a tricky part as well. I just don't know how to configure this.
I run virtual hosts using WAMP likeso:
In httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "I:\web_dev\wordpress"
ServerAlias wordpress.local
ServerName wordpress.local
<Directory "I:\web_dev\wordpress">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require local
</Directory>
</VirtualHost>
My httpd.conf file is set to port 80:
ServerName localhost:80
Hostsfile:
127.0.0.1 wordpress.local
If I now want to access this from another computer or my mobile that are in my network, how do I achieve this?

Allow local traffic in httpd.conf, then use your actual IP as the WP URL.
In WAMP's httpd.conf file, I added the Allow from 192.168 line.
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168
Then in the WP General settings, I changed the Wordpress Address and Site Address to the site's actual IP. You can get this site's IP4 address via ipconfig in the command console.
Then you're done.
If you don't want people on your local network snooping around the rest of your WAMP setup, create a new .htaccess file in the servers root (the www folder) with this:
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Then add this above whatever is in WP's default .htaccess
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168

You'll need to change your Listen directive to listen to the network IP or 0.0.0.0 rather than localhost if that is not yet done.
Then on the other computer edit the hosts (usually C:\windows\system32\drivers\etc\hosts or /etc/hosts) file to include the IP of the webserver computer mapped to wordpress.local
192.168.2.54 wordpress.local

Couple of good tutorials on getting these setup:
View MAMP Virtual Hosts On Your iPad and iPhone Over The Local
Network - BenjaminRojas.net http://goo.gl/6hM4Aa
How to access MAMP sites across a network - CodeBoxers
http://goo.gl/qCXMQK (scroll down to the xip.io portion)
"The solution is to create a local proxy server on the machine that has MAMP installed, and then configure the client to use that proxy to browse the web. The client configuration only takes a few seconds, and is easy to disable once you’re done." - Dalton Rooney (from the first link)

Related

Cannot access wp admin on another computer in local network

I have created a wordpress website on a wampserver 3.2.6 and wanted to access the website, as well as admin panel from another device(pc) on a local network but I get an error (err_refuse_to_connect). I have read some topics and tested some solutions and it partially works. The page loads when I type ip address of the server where the website is, but only text loads, without images and I cannot access the admin panel. I have configured httpd-vhosts.conf file like this:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot D:/wamp64/www
<Directory "D:/wamp64/www">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Also I have created a rule in firewall to allow inbound connections on port 80 and added ip address of a computer I want to connect in hosts file. Is there any simple and clear solution for this?
Change your wordpress setting's URL to a Local IP address.
localhost will always goto 127.0.0.1 but I doubt

how to Connect two pc with single Wamp server

Actually we are developing a new website in PHP . So is it possible to create a environment where we can share our works done .
in simple One wamp and two pc connected with lan is possible or not ? if it is how??
Within your VHOST definition there should be a <Directory ......</Directory> parameter
Inside that add
If you are using Apache 2.2.x
Allow from 192.168.1
If you are using Apache 2.4.x
Require ip 192.168.1
This will allow any ip address starting with 192.168.1 to connect to that VHOST
If you want to be specific and only allow certain ip's you can use this instead
Allow from 192.168.1.10 192.168.1.11
Or, if youare using Apache 2.4
Require ip 192.168.1.10 192.168.1.11
So your VHOST should look like this
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/countlead"
ServerName domain.com
ServerAlias www.domain.com
<Directory "C:/xampp/htdocs/countlead">
AllowOverride All
Require local
Require ip 192.168.2
</Directory>
</VirtualHost>
if run xampp or wamp (apache), and If Dmz (modem option) Forward packet to pc that wamp is run on it (LAN IP Address: exp:192.168.x.x) You Can Use His Remote Ip address To See (wamp/xampp) Root Directory .

Local wordpress website through two PCs

I have already installed XAMPP in my local computer and also a wordpress website. Is there any way to see the default page of my wordpress website (only the page, not the administration) from an another PC in the same network (home network)?
Having a URL such as http://example.dev/index.php instead of http://localhost/example/index.php is much clearer, works better with some website "extensions" involving paths and routing, and stored passwords are much easier to manage in browsers. Let's face it, it's just better all around.
EDIT: Since you've asked for external access (two PCs), I've changed this from my original configuration example, which is isolated from access except through the loopback interface. This example assumes your LAN is properly secured. Either firewall your LAN or change configuration as noted in commented portions of the configuration file to be more specific about access.
There are a few steps to get it working, but once you get used to the two files you'll work with, it's quite easy to set up a new project later.
Activate Modules in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule log_config_module modules/mod_log_config.so
Activate Virtual Host Settings in httpd.conf
#Listen 12.34.56.78:80
Listen 80
<VirtualHost *:80>
Comment out directory information
#DocumentRoot "E:/xampp/htdocs"
#<Directory "E:/xampp/htdocs">
...
Be sure to close the VirtualHost directive before the file includes:
</VirtualHost>
Configure Virtual Hosts Configuration File
After making the previous changes to Apache’s base-level conf file, you can work with the vhost extra conf file (%xampp%/apache/conf/extra/httpd-vhosts.conf).
<VirtualHost *:80>
ServerAdmin webmaster#myexamplesite.dev
DocumentRoot "C:\Users\JHaas\Documents\Projects\MyExampleSite"
ServerName myexamplesite.dev
ServerAlias myexamplesite.dev
ErrorLog "logs/myexamplesite.dev-error.log"
CustomLog "logs/myexamplesite.dev-access.log" common
<Directory "C:\Users\JHaas\Documents\Projects\MyExampleSite">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from none
Allow from all
#Allows a specific IP to access your VHost
#Allow from 10.0.0.24
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
Editing /etc/hosts
Finally, you edit the /etc/hosts file. This file is helps your system bypass the need for a DNS query, allowing you to create your own TLD (top-level domain) suffix such as *.dev, or anything that isn’t going to collide with current new top-level domain suffixes (*.me used to be quite popular until that suffix itself became a TLD suffix).
The localhost entry is not always required (depending on platform), and from my experience has actually caused problems if uncommented, so leave it commented out if it is already. If you see that localhost is not commented out (again, depending on your platform), be sure to leave it so. Changing the localhost entry from default can cause issues for many network services if it’s changed.
Also note that chrome has an issue with using *.local, so it’s probably best to avoid using this TLD suffix.
Host computer:
127.0.0.1 localhost
127.0.0.1 myexamplesite.dev
On the other computer, modify the /etc/hosts file to have an entry for your computer.
10.0.0.27 myexamplesite.dev
You can test your changes to the configuration files via command line using apache/bin/httpd.exe -t. This runs a syntax check on your configuration files.
Lets assume the ip of the pc running xampp is 192.168.0.198 and you are using the standard xampp setting regarding ports and the wordpress sites folder (testproject) sits in the xampp htdocs folder then you could access the site within the local network via:
http://192.168.0.198:8888/testproject/
Hope that helps. Best regards Ralf

How to enable wordpress website locally on network and via localhost

My wordpress site works fine on my mac via localhost, using Xammp. I want to view the site on my iPhone. So I type in 192.168.0.2 and voila, it brings up my localhost directory. I then click on the site in question and the content is there but no styling or images. I realise that this is because the paths to all the resources is hardcoded into the wordpress database. So when I am accessing the url via 192.168.0.2/mywebsitename on my iPhone, it's looking for all the resources using a base url of localhost/mywebsitename. Localhost path doesn't exist on my iPhone, only 192.168.0.2 does.
So has anyone found a solution to this little issue? How can I see a wordpress installation by ip address and by localhost access?
For this exact issue, before developing a website. You must create a domain(VirtualHost in apache)
Add the following contents in the file httpd-vhosts.conf, make sure it is included in Apache Configuration. This line ( Include conf/extra/httpd-vhosts.conf ) should be present in httpd.conf
Contents of httpd-vhosts.conf:
NameVirtualHost 192.168.1.26:80
<VirtualHost 192.168.1.26:80>
<Directory "e:/program files/ampps/www/mywebsite">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
ServerName 192.168.1.26
ServerAlias 192.168.1.26
ScriptAlias /cgi-bin/ "e:/program files/ampps/www/mywebsite/cgi-bin/"
DocumentRoot "e:/program files/ampps/www/mywebsite"
ErrorLog "E:/Program Files/ampps/apache/logs/192.168.1.26.err"
CustomLog "E:/Program Files/ampps/apache/logs/192.168.1.26.log" combined
</VirtualHost>
(Change the path, ip, etc according to your need). Now after adding the contents. Restart Apache. Now when you access 192.168.1.26 (in my case) from other machine in your network or your same machine. You should see the contents of mywebsite folder directly(or contents index.php if it has any). Now install wordpress using the ip you specified(browser should have that ip in the address bar), in my case 192.168.1.26.
Well I use AMPPS to avoid this headache. It allows me to create domains locally. Also if I have bought a domain say mywebsite.com and i want to add a customized wordpress site on, I create a the domain in the AMPPS with the same name. So the URL of my live website and the local are same. :) Then I simply put the files directly on my server via FTP and obviously import the database on my server.
EDIT: BTW, AMPPS allows to install WordPress in a single click. It has simple interface where you can specify AMPPS to install the WordPress on the created Domain.

Hosting multiple domains in Apache2 - how?

Although I’ve found related articles on stackoverflow, I have seen various suggestions which I’ve tried out but I still experience problems, so that’s the reason why I’m posting this.
I have a question which involves DNS, Debian, Apache2 and Wordpress. I’ve been struggling with this for some time now and haven’t been able to solve it. My current conclusion is that 2there is something with my dns and apache virtual host definitions”, but, as I said I’m far from sure.
This is what my config looks like:
two domains which I “own” hosted by moniker.com - let’s call them domaina and domainb
a hosted vps with Debian, apache2 and wordpress. The vps has ip x.y.z.t
each domain has three ‘A’ records defined: ‘*’, ‘#’ and ‘www’
URL rewrite enabled (a2enmod rewrite)
Wordpress installed and links created to the wordpress directory for both document directories specified in the virtualhost directives below
Both ‘domaina’ and ‘domainb’ point to my vps and this is working ok. However, what I’ve been unable to solve is to have the vps handle “multiple virtual hosts”. I thought I would be able to handle this by using virtual hosts in Apache. For that purpose I’ve defined two sites under /etc/apache2/sites-available which looks like this:
(file: /etc/apache2/sites-available/domaina.com)
<VirtualHost x.y.z.t:80>
ServerName domaina.com
ServerAdmin me#domaina.com
DocumentRoot /var/www/domaina.com
DirectoryIndex index.php
<Directory /var/www/domaina.com/>
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
(file: /etc/apache2/sites-available/domainb.com)
<VirtualHost x.y.z.t:80>
ServerName domainb.com
ServerAdmin me#domainab.com
DocumentRoot /var/www/domainb.com
DirectoryIndex index.php
<Directory /var/www/domainb.com/>
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Now, when I try to address the sites above from a web-browser I end up at the default apache directory with the index.html file rendered in the browser instead of arriving at the two different wordpress configurations. Obviously there’s something wrong with my thinking around “VirtualHosts” and/or DNS-configurations…
I forgot to mention that I've made loads of /etc/unit.d/apache2 restarts... Sorry...
Frankly speaking I’m lost here and any help on this would be very much appreciated.
Cheers
If you did restart apache and its still not working please respond, as I have experienced similar issues with Apache, especially when getting the virtual host to work. I realise your running on Debian which is different to WAMP, but this is what I do when opening a new virtual host.
First I add the domain to the windows system 32 drivers etc hosts file, it allows for intranet
127.0.0.1 domainname and this stops the url from looking to the web.
Then I have to add the corret directories to the www/your folder.
Just inside the root folder there ought to be a directory called vhosts,
I had to make totaly empty instances of the conf files with just the filename of the virtual hosts inside it so that the changes you made to the httpd-vhosts.conf works.
So what you will need to do is find the wamp/bin/apache/Apache2.2.21/conf/extra/httpd-vhosts makes sure that you have the one from the conf/axtra and not conf/orginal.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/**name of the folder**"
ServerName **as_inserted_in_hosts**
<directory "c:/wamp/www//**name of the folder**">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
Save. Apache stop all services, I also have to restart the service running the intranet in windows to update the changes to the hosts file and then restart apache.
This is what I have to do so that when I open localhost from Apache it allows me to see the links appear under virtual hosts as well as the directories appearing under your projects.
Have a look at this tutorial... Explains how to set up virtual hosts
Do you have a NameVirtualHost directive in your apache2.conf anywhere? You'll need that to enable virtual hosting. It can go in apache2.conf or any file included by apache2.conf. On my server I've got it in ports.conf.
NameVirtualHost *:80
See http://httpd.apache.org/docs/2.2/vhosts/name-based.html#using

Resources