I am trying to make webpage accessible outside network. I found process to do it.
It says find section " Order Deny,Allow Deny from all"and make changes. problem is:
I don't see that section at all. I tried to add suggested sentences according to previous and next statements. but it says syntax error. so not able to restart services. i did put tab space between two lines. what is right way to add statements?
Also, the content in this file are straight in line. so not easy to read. can i change, so that it will be readable?
I am also getting syntax error in phpmyadmin.conf . the problem is in last line.
code looks like this:
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"
# to give access to phpmyadmin from outside
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#
<Directory "c:/wamp/apps/phpmyadmin4.1.14/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
order Allow,Deny Allow from all Allow from localhost ::1 127.0.0.1</IfDefine>
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value max_execution_time 360
php_admin_value max_input_time 360
</Directory>
So I have to assume you are using WAMPServer2.4 or WAMPServer2.5
I hope 2.5 so start by reading the WAMPServer 2.5 release notes and corrections
Before that download a decent editor, the document suggests Notepad++ as its good and free. That will see the files properly that mistakenly got release with Unix line endings.
For allowing external access have a look at this SO answer The syntax used by Apache 2.4.x has changed from the Allow to Require
Related
i tried to migrate a ruby on rails project from a server to another.
Everything is pretty much working. Now only mod passenger and apache gives me big problems.
Just as a not - i set the following command else i couldnt start apache "a2enmod mod_access_compat"
Now here is my config file:
LoadModule passenger_module /home/homeuser/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/homeuser/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41
PassengerDefaultRuby /home/homeuser/.rvm/gems/ruby-2.1.10/wrappers/ruby
</IfModule>
ServerAdmin ME
ServerName server.ip
# 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 /srv/www/vhosts/default/
DocumentRoot /home/homeuser/projectx/public/
# if not specified, the global error log is used
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On
#ScriptAlias /cgi-bin/ "/srv/www/vhosts/default/cgi-bin/"
#<Directory "/srv/www/vhosts/default/cgi-bin">
# AllowOverride None
# Options +ExecCGI -Includes
# Order allow,deny
# Allow from all
#</Directory>
<Directory "/home/homeuser/projectx/public/">
#
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Options Multiviews Indexes
RailsEnv development
</Directory>
</VirtualHost>
Now the problem.
On my other server i can just call the IP of the server, and the rails installation just opens fine.
Here is just goes into the "public" directory and indexes me all its contents.
I know a fix where you can alter the routes within the routes config file:
get '/something', to: 'start#index'
Now i can reach the website via browser if i type the adress:
server.ip/something
But like i said - i need a pretty much identical version.
So what i need is being able to reach the site via:
server.ip and not server.ip/something
Any help appreciated. Me and my collegues are going crazy about this :-).
EDIT:As an answer to #Aakash Gupta-
Actually "something" is just any string i set in the routes file so i can enter the webapp via browser. What i want instead is to enter the webapp just by typing the pure IP of the server into the browser. Without the "something". So lets make an example: If i type into the browser: www.website.com - it doesnt work. But if i set a route in the routes file, as shown above, i can enter the site by e.g. www.website/start.com or www.website/whatever.com. But i really dont want to have to type something after the url as it has effects on other stuff. So i just want to type in the pure domain/ server address which would be website.com. And then the webapp should appear - but instead i just get shown the contents of the public folder, as there is no index file inside. But on my other server mod passenger is clever enough to still start the webapp, even if i set the public folder is a document root. Hope that clarifies my problem. Like i said - i didnt have problems on other servers. : /
Using WampServer 2.5 on Windows 7 Ultimate 64 bit I am not able to redirect from Wamp index page to Projects URL. For example, I have a Project called "Proj 1" which listed under "Your Projects" but when I click on that the address bar only change to
Proj 1
and I get this error message on page Oops! Google Chrome could not find Proj 1
and when I add localhost/ to the URL inbox it works fine. I tried to re install the Wamp several times but it didn't fix the issue.
Can you please let me know why this is happening and how I can fix this?
The QUICK AND DIRTY way to revert back to the old way and undo this new INTENDED functionality is:-
Edit \wamp\index.php
Find this line at aprox line 34
$suppress_localhost = true;
And change it to
$suppress_localhost = false;
CORRECT Solution
Is to create a VirtualHost for each of your projects that you want to store under the \wamp\www\ folder. Or anywhere else for that matter.
Edit the file \wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
change version number to match your installed version of apache
Remove its default contents and add this to define your first VirtualHost definition
<VirtualHost *:80>
ServerName proj1
DocumentRoot C:/wamp/www/proj1
<Directory "C:/wamp/www/proj1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
Save it!
Now edit the httpd.conf file ( using the wampmanager menu links ) and uncomment the line that includes the file we have just changed.
Find
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
And remove the # comment character like so :-
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Now edit the HOSTS file C:\windows\system32\drivers\etc\hosts and add a new line to tell windows that there is a site called proj1 so it should end up looking like this :-
127.0.0.1 localhost
::1 localhost
127.0.0.1 proj1
::1 proj1
Remember you have to be an Administrator to edit the hosts file!!! Hit the Windows key, type note, right click on Notepad and choose Run as Administrator.
Now to apply that change to the HOSTS file either reboot or
Start a command window using "Run as Administrator" and run these 2 commands :-
net stop Dnscache
net start Dnscache
This will refresh the windows DNS cache, and you new site will be addressable.
Now last of all restart the Apache service so it picks up your new VirtualHost definition.
wampmanager -> Apache -> Service -> Restart service
PS: Remove the space from the "proj 1" folder name. Spaces can cause odd issues. Remember Apache was ported from Unix and Unix does not really like spaces in directory names.
One option could be updating the www index.php (Line 338) from
$projectContents .= '<li>'.$file.'</li>';
to
$projectContents .= '<li>'.$file.'</li>';
I'm having trouble getting my web server to talk to an app in Ruby on Rails. This is especially frustrating because I had it working last year for several months; I assume that some setting changed in the course of an upgrade in the meantime, but I can't find it.
The symptom: when I navigate to the page that should be serving the app (a sub-URI of the main domain), Apache gives a 403 error: "There is either no index document or the directory is read-protected.". The bottom of this error page gives the config string "Apache/2.4.9 (Unix) OpenSSL/1.0.1g Phusion_Passenger/4.0.37", which seems to indicate that Passenger is loaded and running. If I navigate directly to the public directory, or to the physical directory where the app lives, Apache happily displays the file listing of that directory (and if I click on any of the files, they display), so it doesn't seem to be that kind of permissions problem, at least.
In the httpd.conf file, there were the following lines to load Passenger:
LoadModule passenger_module modules/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby
PassengerEnabled Off
PassengerLogLevel 3
and, later, the following lines to tell Apache about the app:
<Location "/pathtoapp/f13">
Options +Indexes +ExecCGI +FollowSymLinks -MultiViews
Order allow,deny
Require all granted
PassengerEnabled On
RackBaseURI /pathtoapp/f13
#RailsEnv production
RailsEnv development
</Location>
The app itself lives in /pathtoapp/f13app, and there was a symlink in the filesystem from /pathtoapp/f13 to /pathtoapp/f13app/public. If I created a symlink /pathtoapp/test to /pathtoapp/f13app/public, it worked fine (in that it showed a file listing for the public directory, so again, no permissions problems).
I tried changing around a few things based on trawling the net for possible solutions. Most didn't appear to affect anything, so I reverted them; I did note that changing Location to Directory meant that navigating to /pathtoapp/f13 in my browser gave me the file listing of the public directory.
I tried (re-)running sudo passenger-install-apache2-module even though the Apache error seemed to indicate passenger was already installed. It (re-?)installed and prompted some changes to httpd.conf, which now has:
LoadModule passenger_module /usr/lib/ruby/gems/2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/lib/ruby/gems/2.1.0/gems/passenger-4.0.37
PassengerDefaultRuby /usr/bin/ruby
</IfModule>
(I'm not sure if passenger did the ruby upgrade into /usr/lib or if that came in some earlier system update I'd done, but the indicated files are indeed there.) Later in httpd.conf, based on the current text of http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rack_to_sub_uri , I now have
Alias /pathtoapp/f13 /pathtoapp/f13app/public
<Location "/pathtoapp/f13">
PassengerBaseURI /pathtoapp/f13
PassengerAppRoot /pathtoapp/f13app
PassengerEnabled On
RailsEnv development
</Location>
<Directory "/pathtoapp/f13app/public">
Options +Indexes +ExecCGI +FollowSymLinks -MultiViews
Allow from all
Require all granted
</Directory>
I then removed the in-filesystem symlink from f13 to f13app/public. And, of course, I've restarted httpd.
passenger-status still reports "ERROR: Phusion Passenger doesn't seem to be running.", and navigating to the app's page (/pathtoapp/f13) still gives the same 403 error. I'm now completely stuck as to what to try next, or even what diagnostic tool I should be using to help triage the problem. Any ideas?
(Extra system info: uname -r is "3.14.1-1-ARCH"; apachectl -v is "Apache/2.4.9 (Unix)"; passenger -v is "Phusion Passenger version 4.0.37")
After a lot of mucking about, I finally discovered that the problem was with the Apache configuration itself: Apache was never getting far enough in to even talk to Passenger. Specifically, on the lines
Alias /pathtoapp/f13 /pathtoapp/f13app/public
and
PassengerAppRoot /pathtoapp/f13app
it's important that the pathtoapp be relative to the filesystem, not the URI. So those two lines should really be more like
Alias /pathtoapp/f13 /srv/http/htdoc/pathtoapp/f13app/public
and
PassengerAppRoot /srv/http/htdoc/pathtoapp/f13app
though of course the exact details will vary by system. I'm not sure if this was an issue with Apache 2.2-2.4 upgrade or something else (I have root access but am not the primary sysadmin on this system), but now that I've found the problem, I didn't want to leave the question hanging. I'll also add that the Apache config line
LogLevel debug
was invaluable in helping me track down which system component the problem was in.
All my services of WAMP server are running, but when I opened my http://localhost/ it gives me this error
"HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory."
You are getting this error because listing directory contents is disabled. Something like this can be found in the apache config file httpd.conf:
Options -Indexes
The reason you're seeing this is probably because of one of two reasons:
You haven't got an index page (index.php or index.html usually)
You have got an index page but your settings are incorrect
Check your apache config for something like this:
DirectoryIndex index.html index.php
Your directory index should list the name(s) of the file(s) that you want to use as the index page. Cross reference the two and you should be able to get it working.
Finally, make sure you always run httpd -t to test your apache configuration after making changes, prior to restarting it.
Change the content of c:\wamp\alias\phpmyadmin.conf file to the following.
<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
And Restart your Apache server after making these changes.
My application is a set of two rails applications. Based on some parameters in first app. I need to setup the virtual host of the second app. I just need to change the ServerName and ServerAlias in apache VH and enable the site using a2ensite and then 'apache2 reload '.
How can I do this from within a rails application?
Thanks,
Imran
First of all: be aware that enabling web-apps to change the server configuration is a security risk.
# First, open the config file
fd=File.open('/etc/apache2/sites/yoursite', 'r+')
# read in the contents
content=fd.read
# now replace the ServerName and ServerAlias lines with your new setting
if content.gsub!(/ServerName(.*)/,"ServerName NewServerName") and content.gsub!(/ServerAlias(.*)/,"ServerAlias NewServerAlias")
fd.rewind
puts "\tsaving file"
fd.write content
end
fd.close
I did not test neither code nor the regular expressions, please load the relevant parts of your config file into rubular.com and roll your own regex.
Maybe you should also make a backup before saving using
File.copy(file,file+".bak",true)