wamp server doesn't go online - apache

I worked with Wamp Server for my work . today I manipulate httpd.config for connect directly to the directory. since I removed this line , wamp server doesn't go online , after I change to previous state and restart wamp , it's still offline. I use Windows 7 and Apache version 2.4.7
<Directory C:\wamp\www\Zend\workspaces\test\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

could you try that ?
DocumentRoot "C:/wamp/www/Zend/workspaces"
ServerName local-portail.com
DirectoryIndex index.php
#AllowOverride All
#Allow from all
#Require all granted
or this
DocumentRoot "C:/wamp/www/Zend/workspaces"
ServerName local-portail.com
DirectoryIndex index.php
#AllowOverride All
#Allow from all
#Require all granted
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>

Is this the section of httpd.conf that you changed?
<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.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 Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
</Directory>
If you want to make another directory the Directory root then a better way is to create a Virtual Host, or many virtual hosts, one for each project.
See this post for how to do that. Ignore the title, it is a post that describes how to setup Virtual Hosts. Project Links do not work on Wamp Server

Related

Apache - You don't have permission to access / on this server

At clg.localhost/ I'm getting error:
You don't have permission to access / on this server.
But, following this, I've set up my Apache httpd.conf and sites.conf to allow access with AllowOverride all and Require all granted. What else am I missing?
Versions:
$ /usr/sbin/httpd -v
Server version: Apache/2.4.23 (Unix)
Server built: Aug 8 2016 18:10:45
Apache httpd.conf:
DocumentRoot "/Users/danniu/Sites"
<Directory "/Users/danniu/Sites">
#
# 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
</Directory>
...
#
# 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 all
Require all granted
</Directory>
Apache sites.conf:
# Workaround for missing Authorization header under CGI/FastCGI Apache:
<IfModule setenvif_module>
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>
# Serve ~/Sites at http://localhost
ServerName localhost
<VirtualHost *:80>
ServerName clg.localhost
DocumentRoot /Users/danniu/Sites/CLG/CLG-dev
</VirtualHost>
I thought perhaps httpd.conf wasn't properly being picked up, so I specified the root directly in the Virtual Host, with the same issue.
<VirtualHost *:80>
ServerName clg.localhost
DocumentRoot /Users/danniu/Sites/CLG/CLG-dev
# Set access permission
<Directory "/Users/danniu/Sites/CLG/CLG-dev">
Require all granted
</Directory>
</VirtualHost>
/ is a directory, so if you don't have an index file pointed to with DirectoryIndex, such as index.html, and you don't have Indexes enabled, as you don't, Apache can't show contents of your documentroot.
Note you have Options FollowSymLinks Multiviews
The solution, to the Options add Indexes like follows for "directory listing" (this depends on mod_autoindex being loaded previously):
Options FollowSymLinks Multiviews Indexes
If you want a default file loaded, for example index.html, DirectoryIndex by default looks for index.html, so add it, or if something its overriding its behaviour somewhere else do:
DirectoryIndex index.html

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;

What is simplest way to add domain name to a Debian server?

I have the latest brand new Debian server. The website should host only 1 single domain name.
DNS are resolved by the registrar and A points to my dedicated server. Site is present in /var/www/.
What is the simplest way (step by step) to configure Apache to add this domain name?
It should be very straighforward:
Install Apache (sudo aptitude install apache2)
The default configuration points to /var/www so...
Start Apache (sudo service apache2 restart)
Enjoy your website
You can add your domain name into /etc/hosts
Take some steps to secure your dedicated server (iptables, fail2ban, ...)
You could also use the automatic wizard with sudo dpkg-reconfigure apache2.
I think this should be enough if you DNS is already pointing at your IP.
If you really need to change the configuration file, it's in etc/apache2/sites-available/default and contains the following (by default):
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster#localhost # <= Email of webadmin (shown on error pages)
DocumentRoot /var/www/ # <= Root of your web server with public access
<Directory />
Options FollowSymLinks
AllowOverride None # <= Disable usage of .htaccess files
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
As for the hosts file, you can add the following:
# 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
#Virtual Hosts
12.34.56.789 example.com #<= change here :)
Then, don't forget to secure your web server with appropriate tools (iptables, fail2ban, ...)

Forbidden: You don't have permission to access / on this server

I keep having this access denied error. I'm using apache 2.2.15 on CentOs 6.4.
The server is running with user apache and group apache.
In home, I have a user staging. I added him to the apache group.
Permissions on the docs folder are:
drwxrwx--- 2 staging staging 4096 Oct 4 14:33 docs
I'm testing with an index.html file:
-rw-r--r-- 1 staging staging 13 Oct 4 14:28 index.html
SELinux is disabled. The address I'm using is staging.mysite.com
My httpd.conf looks like this:
<Directory "/home/*/docs">
#
# 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 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.
#
Order allow,deny
Allow from all
</Directory>
I also have a virtual host set to my staging address:
<VirtualHost SERVERIP:80>
ServerName staging.mysite.com
DocumentRoot /home/staging/docs
ServerAdmin staging#mysite.com
CustomLog /home/staging/logs/access_log combined
</VirtualHost>
If you need more info let me know but any idea why it's giving me this error?
Well, as you stated it, the docs folder is only readable by the staging user and the staging group. So the apache user may not read it.
One solution would be to add the apache user to the staging group.
I can fixed the same error:
To Modify at your nagios configuration the options parameter +Indexes and add DirectoryIndex index.php
Maybe show be:
<Directory "/home/*/docs">
#
# 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 FollowSymLinks +Indexes
DirectoryIndex index.php
#
# 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.
#
Order allow,deny
Allow from all
</Directory>
And, finally restart your apache service.
Check the permission /home/ can be +x and +r, like chmod +rx /home/.

Share localhost on LAN, WAMP

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.