Still have MySQL problems that need to get solved soon (was: Re: Apache and MySQL won't start)

Scott Haneda talklists at newgeo.com
Thu Jul 29 12:10:36 PDT 2010


On Jul 29, 2010, at 11:31 AM, Ali A Samii wrote:

> On 29 Jul, 2010, at 20:03 , Scott Haneda wrote:
> 
>> On Jul 29, 2010, at 9:44 AM, Ali A Samii wrote:
>> 
>> For your example:
>>   /opt/local/apache2/conf/extra/vhosts/dev.thesamiis.com.conf
>>   /opt/local/apache2/conf/extra/vhosts/phpmyadmin.conf
>>   /opt/local/apache2/conf/extra/vhosts/dev.lesamisdestan.com.conf
>> 
>> Each of those will allow me to define for just that host, what I want the settings to be.
>> * Below is a snipped version of my template file, in general it is more complex, with log locations, log levels, aliases, default favicon, etc but this should work for a dev box.
> 
> could you possibly send me a "more complex" version as an attachment with notes of why you have defined things they way you have? (I assume that doesn't need to go to the list at large, unless others also want to see some beautiful configuration examples).

Just go to the Apache documentation and look at the options for virtual host and directory container blocks.  There are far too many to list and they would all be specific to my setup, which is for "ISP" style hosting, and not really targeted to local development.  

I snipped it down to something more simple that *may* lean on local development, but that is up to the developer and how they want to work, and how much friction they want on their dev machine, versus how much friction they want when moving it to the production machine.

For example, I have been developing with git lately, and syncing my git tree from my local machine to the staging server, and then to the live production server.  That would be even further outside the scope of what the MacPorts mailing list is here for.

>> $cat template.txt 
>> # START example.com
>> <VirtualHost *:80>
>> 	DocumentRoot "/opt/local/www/clients/last.first/example.com"
>> 	ServerAdmin user at example.com
>> 	ServerName example.com
>> 	ServerAlias www.example.com
>> 	DirectoryIndex index.html
> 
> Above, you have ServerName and ServerAlias. What is the difference between them and why would you specify that level of precision?

So I don't have to have two files, with duplicate data, one for example.com and one for www.example.com. In general, most want or assume that if you go to macports.org that also www.macports.org should work.  You should chose one, and use mod_rewrite or something similar to make sure that no matter what the request, only one is ever used.
ie:  http://www.example.com/some/place/requested/file.php?foo=bar
     http://example.com/some/place/requested/file.php?foo=bar

On a technical level, I would want to do this for cookies.  If someone logs into www.example.com and I set a session cookie which the user has defined as "remember me", when they come back to example.com they would not be remembered.  I tend to shy away from wildcard domain paths in cookies for some reason.

On a non technical level, for SEO, I would only want one canonical source, either with the www or without, doesn't matter, but I do not want duplicate content in the served files, or my config files.

> Also, I assume by defining DirectoryIndex, you define what default file to load (in the even there is a *.html, *.php, *.asp etc), right?

Correct.

> By having the structure within /opt/local/www the way you have it, I assume you could go to http://localhost/clients and you will see a list of client directories (last.first), and likewise, within each client directory separate sites/projects, if they have more than one?

Yes, but again, by traversing into those directories, most of the sites would not work.  All links are relative to the document/site root.  By entering at another access point like that, the entire path structure changes. Not very many people, unless they are using something like DreamWeaver are going to img src="../../../file.jpg" but instead, if hand coded, may img src="/images/home/header/file.jpg".

>> 	# php setttings
>> 	php_admin_value open_basedir "/opt/local/www/clients/last.first/example.com/:/private/var/tmp/:"
>> 	php_value engine off
>> 
>> 	<Directory "/opt/local/www/clients/last.first/example.com">
>> 		Options FollowSymLinks
>> 		AllowOverride All
>> 		Order allow,deny
>> 		allow from all
>> 	</Directory>
> 
> Do the above lines basically implement the .htaccess controls?

Not entirely.  I probably would not use AllowOverride All on a production server, or shared server at least.  Depends on the setup though.  If it is a "VM" type of system, sure.  It really all depends on your case.  These are either issues you can solve by looking at the Apache docs when you need to set something up, or joining the Apache mailing list.

There is no right or wrong setting, except that my settings will be wrong for your system.  These are more examples to illustrate a concept, which you should adapt to your needs, desires, and workflow.
-- 
Scott (* For off-list contact, replace talklists@ with scott@ *)



More information about the macports-users mailing list