Share localhost on LAN, WAMP - apache

I have a simple PHP project just php and apache, and i want to share this project on my localnetwork, how i can figure this out?
I've try some solutions founded here but can't make it work.
Someone have any ideia?
I've already change my httpd.conf from apache folder to:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
And changed:
Listen 80
to:
Listen 192.168.50.1:80
But don't work either.

Well change it all back.
This change allows access to the root directory of the drive you installed wamp onto. NOT A GOOD IDEA. S change it back to :
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
and also back to
Listen 80
Assuming you website is in c:\wamp\www and if your subnet is in fact 192.168.50 like you have used above the simple way to allow access to your site over the local network only is to change this part of httpd.conf
Look for
<Directory "c:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
And change this part of that section
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
Allow from 192.168.50
the line Allow from 192.168.50 will allow access from any ip on that subnet i.e. 192.168.50.1 -> 192.168.255
If you put your site into a subfolder then do this:
<Directory "c:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
</Directory>
<Directory "c:\wamp\www\sitefolder">
Options Indexes FollowSymLinks
AllowOverride all
Allow from 192.168.50
</Directory>
This will keep your wampserver homepage secure but allow access to the site in sitefolder to everyone in the local network.

Related

Require not ip isn't blocking IP address on apache centos server

I'm trying to block an IP from my server and prevent them from being able to load my website, I've added their IP to the httpd.conf file and have successfully restarted httpd, but after trying to load the website, I'm still able to access the website, surely I'm not missing something obvious here am I?
What am I doing wrong?
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</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.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/MY-SITE/dist"
#
# Relax access to content within /var/www.
#
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
<RequireAll>
Require all granted
Require not ip X.X.X.X
</RequireAll>
# Header set Access-Control-Allow-Origin "*"
</Directory>
In here
<Directory "/var/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
<RequireAll>
Require all granted
Require not ip X.X.X.X
</RequireAll>
# Header set Access-Control-Allow-Origin "*"
you need to change Directory path like this
<Directory "/var/www/MY-SITE/dist">
then try it. thnak you

Disable directory browsing apache isn't working

I want to disable directory browsing in WordPress. But it's not working.
Please help me. I've already edit htaccess (Options -Indexes)
This is folder httpd
<Directory "${INSTALL_DIR}/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options +Indexes +FollowSymLinks +Multiviews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
<Directory ${INSTALL_DIR}/www/wp-includes>
Options -Indexes
AllowOverride None
Order allow,deny
</Directory>
There is some inconsistency in your config file. I'm thinking that
<Directory ${INSTALL_DIR}/www/wp-includes>
Should actually be
<Directory "${INSTALL_DIR}/www/wp-includes/">
Notice the missing " quotes and /
Also
AllowOverride all
should be
AllowOverride All
Notice the capital A on All
If that doesn't fix your problem let me know what version of Apache and is this Windows or Linux.

Access wamp (as web server) // Apache 2.4 // globally

I want my wamp64 server webpages to can be access globally and not only from my local network.
<Directory />
AllowOverride none
Require all granted
</Directory>
<Directory "C:/wamp64/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order allow,deny
Allow from all
Require all granted
</Directory>
Now, if i try to access it from my mobile, there showing an empty (white) page. Same if i put at the url /folder_name
Apache file code here: http://pastebin.com/A7xxiQ6B
This section must never be changed Specially if you are allowing the universe into your site, as this protects the root and all sub folders on the drive that Apache is installed on. Standard process is to block access to EVERYTHING which this does, and then only allow access to those folders APache actually needs access to.
<Directory />
AllowOverride none
Require all granted
</Directory>
Change it back to
<Directory />
AllowOverride none
Require all denied
</Directory>
And in this part you are using Apache 2.2 AND Apache 2.4 syntax which normally gets Apache confused. So remove the Apache 2.2 syntax so it should look like this
# onlineoffline tag - don't remove
Require all granted
Of course you will also need to Port Forward post 80 on your router.
And the PC running WAMPServer will need to be on a static IP address so that that port forwarding always works.
Well, the followings working for me. Figure it out :)
Just add to C:\Windows\System32\drivers\etc\hosts
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost <-- Uncomment this
# ::1 localhost
127.0.0.1 xxxxxx.ddns.net <-- Add here your public IP or your Dynamic DNS name
If you have your httpd.conf as the following
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
ServerName xxxxx.ddns.net:80
<Directory "C:/wamp64/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
and C:\wamp64\alias\phpmyadmin.conf
<Directory "C:/wamp64/apps/phpmyadmin4.5.2/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
..............
</Directory>
You will be able (probably) too see your wamp online.
Please note you have to configure your vhosts from localhost\add_vhost.php for your every project (www/folder_name) and change the C:\wamp64\index.php from
$suppress_localhost = true;
to
$suppress_localhost = false;

Changed Apache configurations, now localhost/~username/index.php throws 403 Error

I have been struggling to get laravel php framework up and running on my mac with yosemite. I have made changes to both the httpd.conf file in /etc/apache2 as well as my user config file username.conf. Now after changing it back I get a 403 "Forbidden You don't have permission to access /~username/my_phpinfo.php on this server." Also I should not that I am using Apache/2.4.9. This is the user conf file I currently have:
<Directory "/Users/<username>/Sites/">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
I also feel like possible errors could be in this section (line number~=238) of the httpd.conf file:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Require all granted
Order allow,deny
Allow from all
</Directory>

Can't access website from outside?

So I can't access my website from outside for some reason. I've tried the command "ping xxx" from cmd but I get a timeout. I can access the database from outside though. I have port-forwarded 80 and also tried turning off my firewall & allowing port 80 TCP/UDP both in and out.
I can access it locally (from my computer and on the same network)
My httpd.conf looks like this:
<Directory "D:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order allow,deny
Allow from all
Deny from none
</Directory>
Any ideas of how I can fix this?
Try replacing this Apache 2.2 syntax with Apache 2.4 syntax.
From
Order allow,deny
Allow from all
Deny from none
To
Require all granted