Problems getting Apache running under Mac 10.9.1 Mavericks - macos

all.
I am having ongoing problems getting Apache running under Mac 10.9.1 Mavericks (newest version).
I have apache running ("org.apache.httpd: Already loaded")
When I look at /etc/apache2/users/myfile.conf I see:
<Directory "/Users/rickeisner/Sites/">
Options Indexes Multiviews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
But when I run "apachectl configtest" to check the installation, I get:
[Tue Jan 21 12:21:51 2014] [warn] module php5_module is already loaded, skipping
Syntax error on line 4 of /private/etc/apache2/other/phpMyAdmin.conf:
order not allowed here
and when I look at /private/etc/apache2/other/phpMyAdmin.conf I see:
Alias /phpMyAdmin /usr/local/phpMyAdmin
Options Indexes
Order allow,deny
Allow from all
I can't make hide nor hair of this. Which is "line 4" anyway? "Options Indexes" or "Order allow,deny"? And what is wrong with this file?
I should add that I was only trying to get Apache/PHP/MySQL working on my computer, and couldn't get anything to work. Then, I began looking and found TOO MUCH INFORMATION. Everyone has slightly different versions of /etc/apache2/users/myfile.conf .
Please help me out of this confusion!
Rick

Related

Mojave - /Library/Webserver/Documents folder permisisons

I hope someone can help. I have apache running on my mac with my websites loacated at: /Library/Webserver/Documents/mywebsite
It works fine if I go to: http://mywebsite.localhost
... but everytime I try to edit a file in 'mywebsite' directory I get a "{filename} is a locked file and can only be viewed".
If I do a 'get info' on /Library/Webserver/Documents - the result is:
{myuser} : read & write
system : read & write
wheel : read only
everyone : read only
If I do a 'get info' on /Library/Webserver/Documents/mywebsite/index.php - the result is:
{myuser} : Read & write
staff : Read only
everyone : read only
.. but it still says it's locked and read only?
I could move the site folder to /Users/{myuser}/Sites/mywebsite which fixes the problem of permissions but I don't want to have to go to:
http://localhost/~myuser/mywebsite
Can anyone advise?
I moved the site folder to
/Users/{myuser}/Sites
which solved the permission problem then added the site to the httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "/Users/{myuser}/Sites/mywebsite"
ServerName mywebsite.localhost
</VirtualHost>
Which has solved the URL issue:
http://mywebsite.localhost

Apache - changing document root (Mac)

I'm just getting started using Apache on my Mac (El Capitan 10.11.13), but I'd like to change the document root. However, I'm not sure I fully understand how to do this, or if it is even possible to set it up the way that I would like to...
For starters, here's the snippet from my httpd.conf file (I haven't made any changes, this is stock)...
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 None
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
I would like to change the DocumentRoot to the folder where I generally keep my web development work, which is:
/Users/myname/Desktop/Stuff/Development
I know that the first step is to replace the DocumentRoot and Directory in the .conf file, but this doesn't work - I get the 403 forbidden error - and I'm not sure what to do after that.
My questions...
Is it possible to set the document root to a folder that is associated with a specific user - me, in this case? I'm the only user of my machine, and it would be much easier for me to do what I need to if Apache was pointed at that folder.
If so, what do I need to do other than change the first two lines from the snippet of my .conf file? Please be specific, as I'm relatively new to working with the terminal.
Thanks very much.
Yes you can't just change DocumentRoot without giving the permission to new path. If you must use it you have to add chmod +x to each path, in your case those are
User
myname
...
Development
It is not safe to do so. I would user a folder doesn't involved Users.

Error PhusionPassenger::Rack::ApplicationSpawner::Error

I have error with passenger.
I set up redmine in VPS. It run ok when I run in webrick. I used to passenger to run redmine on port 80.
path: usr/local/apache/conf/httpd.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRuby /usr/bin/ruby
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17
PassengerMaxPoolSize 2
PassengerMaxInstancesPerApp 2
PassengerPoolIdleTime 100
<VirtualHost 112.78.6.191:80>
ServerName projects.gzerone.com
ServerAlias www.projects.gzerone.com
DocumentRoot /home/gzerone/public_html/redmine-2.1.2/public
RailsEnv production
#ErrorLog /usr/local/apache/logs/redmine.error.log
#RackBaseURI /rails
ServerAdmin webmaster#projects.gzerone.com
#UseCanonicalName Off
#CustomLog /usr/local/apache/domlogs/projects.gzerone.com combined
#CustomLog /usr/local/apache/domlogs/projects.gzerone.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User gzerone # Needed for Cpanel::ApacheConf
<Directory /home/gzerone/public_html/redmine-2.1.2/public>
#AllowOverride all
Allow from all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
<IfModule mod_suphp.c>
suPHP_UserGroup gzerone gzerone
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup gzerone gzerone
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid gzerone gzerone
</IfModule>
ScriptAlias /cgi-bin/ /home/gzerone/public_html/redmine-2.1.2/public/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/gzerone/projects.gzerone.com/*.conf"
In error_log of apache:
[ pid=23984 thr=23634338875820 file=utils.rb:176 time=2012-11-23 10:39:34.067 ]: *** Exception Errno::ENOMEM in PhusionPassenger::Rack::ApplicationSpawner (Cannot allocate memory - fork(2)) (process 23984, thread #<Thread:0x2afd98bf1358>):
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:462:in `fork'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:462:in `safe_fork'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rack_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rack_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99
I hope. You give any suggestion to fix it.
As you can see in the logs, the ApplicationSpawner is crashing because of an out-of-memory errors. You don't have enough memory.
There are several things you can do:
Use conservative spawning so that you don't have an ApplicationSpawner process. Since your pool size is only 2, using an ApplicationSpawner does not bring you any advantages.
Add more swap space.
Upgrade your RAM.
Had the same problem, I believe it has something to do with Passengers control and optimizations options such as PassengerMaxPoolSize. You might need to set it higher than 2. I noticed the error occurred the first time someone viewed my application on another computer synchronously.
To quick fix, try going into the project directory and rebundle the app by bundle install then restart the web server, sudo service httpd restart this should reset Passenger.
Also, a missing config.ru file resulted in the same error message. You might want to check out the discussion here.
Wish I could tell you WHY this happened, hopefully someone will. I'd love to understand the exact problem mysef, to fix permanently.

How can I use a Dropbox directory as a virtual host Document Root in OSX?

I set up LAMP on my OSX Lion server and everything seems to be working fine when I leave the defaults on.
Either:
A) Removing the username.conf file from /etc/apache2/users leaves the default running:
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.2/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:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
B) Otherwise, i.e. if i leave username.conf in the destination for localhost goes to the default in username.conf which is:
NameVirtualHost *:80
<Directory "/Users/USERNAME/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
I would like to create a virtual host that points to one of my dropbox subdirectories so that I can develop seamlessly across devices.
However, when I try to point to /Users/USERNAME/Dropbox and any subdirectory therein I get the following errors:
[Fri Feb 24 19:00:06 2012] [error] [client 127.0.0.1] client denied by server configuration: /Users/username
[Fri Feb 24 19:00:35 2012] [notice] caught SIGTERM, shutting down
Warning: DocumentRoot [/Users/username/Dropbox/MY/DIRECTORY] does not exist
httpd: Could not reliably determine the server's fully qualified domain name, using My-MacBook-Air.local for ServerName
[Fri Feb 24 19:00:36 2012] [warn] mod_bonjour: Skipping user 'USERNAME' - no valid index file.
[Fri Feb 24 19:00:36 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Feb 24 19:00:36 2012] [notice] Digest: done
[Fri Feb 24 19:00:36 2012] [notice] Apache/2.2.21 (Unix) DAV/2 PHP/5.3.8 with Suhosin-Patch configured -- resuming normal operations
Where and what can I change to allow access?
Don't use Dropbox. If you need this kind of functionality, use WebDAV or host your own SparkleShare server.
Dropbox has had a series of security problems (even recent ones) that make it "scary" for many IT people. There's even software like Dropship that was designed to take advantage of some of its vulnerabilities. (Dropship doesn't work anymore, but it did for an alarmingly long time.) There has been at least one complaint to the FTC about Dropbox making false security claims on their web site. Respected journalists have reported on failures with Dropbox's subscription model that indicate the company still hasn't got it together.
Dropbox-the-company aside, you're asking a third party to keep an unencrypted copy of your data. This may be your source code for a site, log data or temporary files that might contain privileged/sensitive information. YOU may not be nervous about this, but what about the people who interact with you, whose data you may inadvertently be exposing to a third party (or their security policy) without disclosure?
For a hobby site, perhaps it doesn't matter. But a hobby site is what trains you for larger projects. You'd be better off getting in to good habits earlier rather than later.
If you need Dropbox-style functionality, SparkleShare is an open-source workalike that lets YOU provide the shared storage for your files. There are others. Put them on your co-located server, access them via SSH. You can review the source code of SparkleShare's (or any of the other open source optons) so that your safety is in YOUR hands, rather than that of corporation whose priority is their bottom line rather than your safety and security. (Why does Dropbox spend any money paying developers to fix security holes? Because it improves their bottom line. There can be NO other reason, according to US corporate law. A corporation's sole priority is to maximize shareholder return.)

Apache2 doesn't execute .rb files (mod_ruby)

I want to make apache2 run ruby scripts. I managed to do this by using CGI, but now I want to go one step further and do it with mod_ruby. I installed mod_ruby through apt-get so it's supposed to be enabled, but when I visit http://localhost/test.rb my browser downloads the file instead of displaying it's output.
If I open /etc/apache2/mods-enabled/ruby.load there is a line containing the path do this mod.
I also added the following lined to my apache2.conf:
<IfModule mod_ruby.c>
<Directory /var/www/>
Options +ExecCGI
</Directory>
RubyRequire apache/ruby-run
#RubySafeLevel 0
<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
</IfModule>
Can you please help me?
PS. Please don't suggest using ROR. I'm familiar with that. Now I just want to use ruby for educational reasons. Also please keep things simple I'm a total newbie to apache.
See this article - it has some instructions. Basically you need to tell Apache to pass your Ruby files through the handler.
Also, consider trying Sinatra - it's a micro web framework that's as simple as plain ruby files. And it runs with Passenger which is the well-documented Ruby module for Apache.
The article on HowtoForge covers almost the whole story, but I needed to add one line inside the <Directory /var/www> directive to prevent browsers from downloading the file:
AddType text/html .rb .rbx
Here are a couple more sites that I found helpful:
https://defuse.ca/blog/2012/07/how-to-install-mod_ruby-on-debian-squeeze/
http://modruby.net/en/doc/
Debian Stretch 9.
I tried installing mod_ruby with apt-get install libapache2-mod-ruby but there is no package by that name. In the end, all I needed to do was add this line to the apache-config to get the server to run my scripts.
AddHandler cgi-script .rb

Resources