PDA

View Full Version : ScritpAlias problem and (still) failure to comprehend?



tarzy
19-Sep-2013, 06:44
I had received some tutelage via an earlier reply toa couple of lines which I adjusted, and this post's subject was part of the return after trying to start Apache. I have searched a decent amount and can't find what the answer is, but I must be honest that I've not delved into the Documentation either, mostly due to no time to relax and deal with my intermittent Dyslexia. Just today I swore a "9" on my own published (Musical diagram) was a "6" and told the person I was involved that my diagram was a typo, then after looking twice more discovered I had been looking at the "6" as an inverted "9". I couldn't believe it!

Anyhow, here's my current failure message:

linux-2u6o:~ # /etc/init.d/apache2 start
Starting httpd2 (prefork) Syntax error on line 60 of /etc/apache2/default-server.conf:
ScriptAlias takes two arguments, a fakename and a realname

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

Here's the file: default-server.conf (line 60 asterisk'd since bold or text color wanted to insert html tags into the post) for analyisis, and I'm sorry that I don't know how to write the correct info there. I've not had to since I did my very first Linux machine in '08:

#
# Global configuration that will be applicable for all virtual hosts, unless
# deleted here, or overriden elswhere.
#

DocumentRoot "/srv/www/htdocs"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
# 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 None
# 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>

# Aliases: aliases can be added as needed (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
*************ScriptAlias /srv/wwwcgi-bin/*****************

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/srv/www/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# To disable it, simply remove userdir from the list of modules in APACHE_MODULES
# in /etc/sysconfig/apache2.
#
<IfModule mod_userdir.c>
# Note that the name of the user directory ("public_html") cannot simply be
# changed here, since it is a compile time setting. The apache package
# would have to be rebuilt. You could work around by deleting
# /usr/sbin/suexec, but then all scripts from the directories would be
# executed with the UID of the webserver.
UserDir public_html
# The actual configuration of the directory is in
# /etc/apache2/mod_userdir.conf.
Include /etc/apache2/mod_userdir.conf
</IfModule>


# Include all *.conf files from /etc/apache2/conf.d/.
#
# This is mostly meant as a place for other RPM packages to drop in their
# configuration snippet.
#
# You can comment this out here if you want those bits include only in a
# certain virtual host, but not here.
#
Include /etc/apache2/conf.d/*.conf

# The manual... if it is installed ('?' means it won't complain)
Include /etc/apache2/conf.d/apache2-manual?conf
ServerName 192.168.1.26
ServerAdmin admin@craigtarwater.com

At least now I must be getting close.....

Regards, tarzy!

smflood
19-Sep-2013, 11:33
On 19/09/2013 06:54, tarzy wrote:

> I had received some tutelage via an earlier reply toa couple of lines
> which I adjusted, and this post's subject was part of the return after
> trying to start Apache. I have searched a decent amount and can't find
> what the answer is, but I must be honest that I've not delved into the
> Documentation either, mostly due to no time to relax and deal with my
> intermittent Dyslexia. Just today I swore a "9" on my own published
> (Musical diagram) was a "6" and told the person I was involved that my
> diagram was a typo, then after looking twice more discovered I had been
> looking at the "6" as an inverted "9". I couldn't believe it!
>
> Anyhow, here's my current failure message:
>
> linux-2u6o:~ # /etc/init.d/apache2 start
> Starting httpd2 (prefork) Syntax error on line 60 of
> /etc/apache2/default-server.conf:
> ScriptAlias takes two arguments, a fakename and a realname
>
> The command line was:
> /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
>
> Here's the file: default-server.conf (line 60 asterisk'd since bold or
> text color wanted to insert html tags into the post) for analyisis, and
> I'm sorry that I don't know how to write the correct info there. I've
> not had to since I did my very first Linux machine in '08:

...snip..

> # ScriptAlias: This controls which directories contain server scripts.
> # ScriptAliases are essentially the same as Aliases, except that
> # documents in the realname directory are treated as applications and
> # run by the server when requested rather than as documents sent to the
> client.
> # The same rules about trailing "/" apply to ScriptAlias directives as
> to
> # Alias.
> #
> *************ScriptAlias /srv/wwwcgi-bin/*****************
>
> # "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
> # CGI directory exists, if you have that configured.
> #
> <Directory "/srv/www/cgi-bin">
> AllowOverride None
> Options +ExecCGI -Includes
> Order allow,deny
> Allow from all
> </Directory>

...snip..

> At least now I must be getting close.....

You are but obviously there is a problem with the ScriptAlias line for
which I earlier indicated - the syntax is

ScriptAlias URL-path file-path|directory-path

Based on your "ScriptAlias /srv/wwwcgi-bin/" line above plus the
Directory section which follows I think you need to add something
between the "ScriptAlias" and "/srv/wwwcgi-bin" (which in itself should
be changed to "/srv/www/cgi-bin" to match the Directory section path).

The "something" is down to you but is usually some variation of cgi-bin
so you end up with

ScriptAlias cgi-bin /srv/www/cgi-bin

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

tarzy
19-Sep-2013, 20:05
I'm back to this error:

linux-2u6o:~ # /etc/init.d/apache2 start
Starting httpd2 (prefork) Syntax error on line 10 of /etc/apache2/vhosts.d/ip-based_vhosts.conf:
ScriptAlias takes two arguments, a fakename and a realname

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
failed

Here's the current ip-based_vhosts.conf:

<VirtualHost playguitarvideos.com>
DocumentRoot /srv/www/htdocs/pgvdotcom
ServerName playguitarvideos.com
ServerAdmin admin@playguitarvideos.com
<Directory /srv/www/htdocs/pgvdotcom>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/
<Directory /srv/www/cgi-bin>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
UserDir public_html
</VirtualHost>
<VirtualHost craigtarwater.com>
DocumentRoot /srv/www/htdocs/ctdotcom
ServerName craigtarwater.com
ServerAdmin admin@craigtarwater.com
<Directory /srv/www/htdocs/New Folder>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/
<Directory /srv/www/cgi-bin>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
UserDir public_html
</VirtualHost>

I would try to correct this say, using my current www server's info that is working, but I have not found this file in it's setup.

As mentioned, I do not understand the two arguments: fakename, and realname, or whether thye go on line 10 or elsewhere.

Regards, tarzy

smflood
20-Sep-2013, 11:09
On 19/09/2013 20:14, tarzy wrote:

> I'm back to this error:
>
> linux-2u6o:~ # /etc/init.d/apache2 start
> Starting httpd2 (prefork) Syntax error on line 10 of
> /etc/apache2/vhosts.d/ip-based_vhosts.conf:
> ScriptAlias takes two arguments, a fakename and a realname
>
> The command line was:
> /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
>
> failed
>
> Here's the current ip-based_vhosts.conf:
>
> <VirtualHost playguitarvideos.com>
> DocumentRoot /srv/www/htdocs/pgvdotcom
> ServerName playguitarvideos.com
> ServerAdmin admin@playguitarvideos.com
> <Directory /srv/www/htdocs/pgvdotcom>
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> ScriptAlias /cgi-bin/
> <Directory /srv/www/cgi-bin>
> AllowOverride None
> Options +ExecCGI -Includes
> Order allow,deny
> Allow from all
> </Directory>
> UserDir public_html
> </VirtualHost>
> <VirtualHost craigtarwater.com>
> DocumentRoot /srv/www/htdocs/ctdotcom
> ServerName craigtarwater.com
> ServerAdmin admin@craigtarwater.com
> <Directory /srv/www/htdocs/New Folder>
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> ScriptAlias /cgi-bin/
> <Directory /srv/www/cgi-bin>
> AllowOverride None
> Options +ExecCGI -Includes
> Order allow,deny
> Allow from all
> </Directory>
> UserDir public_html
> </VirtualHost>
>
> I would try to correct this say, using my current www server's info that
> is working, but I have not found this file in it's setup.
>
> As mentioned, I do not understand the two arguments: fakename, and
> realname, or whether thye go on line 10 or elsewhere.

I'm not sure how to say this any simpler - your two ScriptAlias lines
(which seem to be duplicates along with the relevant Directory
/srv/www/cgi-bin sections) are invalid because they are missing a
parameter. You have "ScriptAlias /cgi-bin/" but they should be
"ScriptAlias /path/to/dir/ /cgi-bin/" where "/path/to/dir/" should
probably be "/srv/www/cgi-bin/" to match your Directory sections.

Until you fix that Apache won't start.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

tarzy
20-Sep-2013, 16:15
Thnaks much; I now have what you specified as my only error:

linux-2u6o:~ # /etc/init.d/apache2 start
Starting httpd2 (prefork) Syntax error on line 23 of /etc/apache2/vhosts.d/ip-based_vhosts.conf:
Multiple <Directory> arguments not (yet) supported.

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf failed


I have learned something here, to a degree, which is that I will need to take the time to delve into and understand the command-line procedures, and what is and is not. I see where the /srv/www/cgi-bin/ /cgi-bin/ stopped the previous error. The new one above supports your observation of "duplicate directories". So I have assumed that each virtual host needed what's written here, but obviously not.
************************************************** ***************
<VirtualHost playguitarvideos.com>
DocumentRoot /srv/www/htdocs/pgvdotcom
ServerName playguitarvideos.com
ServerAdmin admin@playguitarvideos.com
<Directory /srv/www/htdocs/pgvdotcom>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /srv/www/cgi-bin/ /cgi-bin/
<Directory /srv/www/cgi-bin>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
UserDir public_html
</VirtualHost>
<VirtualHost craigtarwater.com>
DocumentRoot /srv/www/htdocs/ctdotcom
ServerName craigtarwater.com
ServerAdmin admin@craigtarwater.com
<Directory /srv/www/htdocs/New Folder>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /srv/www/cgi-bin/ /cgi-bin/
<Directory /srv/www/cgi-bin>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
UserDir public_html
</VirtualHost>
************************************************** *****************************

So the entire ip-based.conf only needs a single ScriptAlias then, correct? (I am doing this slowly BTW, as I'm up to my eyeballs in many tasks besides this new machine)

Regards. tarzy


On 19/09/2013 20:14, tarzy wrote:

> I'm back to this error:
>
> linux-2u6o:~ # /etc/init.d/apache2 start
> Starting httpd2 (prefork) Syntax error on line 10 of
> /etc/apache2/vhosts.d/ip-based_vhosts.conf:
> ScriptAlias takes two arguments, a fakename and a realname
>
> The command line was:
> /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
>
> failed
>
> Here's the current ip-based_vhosts.conf:
>
> <VirtualHost playguitarvideos.com>
> DocumentRoot /srv/www/htdocs/pgvdotcom
> ServerName playguitarvideos.com
> ServerAdmin admin@playguitarvideos.com
> <Directory /srv/www/htdocs/pgvdotcom>
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> ScriptAlias /cgi-bin/
> <Directory /srv/www/cgi-bin>
> AllowOverride None
> Options +ExecCGI -Includes
> Order allow,deny
> Allow from all
> </Directory>
> UserDir public_html
> </VirtualHost>
> <VirtualHost craigtarwater.com>
> DocumentRoot /srv/www/htdocs/ctdotcom
> ServerName craigtarwater.com
> ServerAdmin admin@craigtarwater.com
> <Directory /srv/www/htdocs/New Folder>
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> ScriptAlias /cgi-bin/
> <Directory /srv/www/cgi-bin>
> AllowOverride None
> Options +ExecCGI -Includes
> Order allow,deny
> Allow from all
> </Directory>
> UserDir public_html
> </VirtualHost>
>
> I would try to correct this say, using my current www server's info that
> is working, but I have not found this file in it's setup.
>
> As mentioned, I do not understand the two arguments: fakename, and
> realname, or whether thye go on line 10 or elsewhere.

I'm not sure how to say this any simpler - your two ScriptAlias lines
(which seem to be duplicates along with the relevant Directory
/srv/www/cgi-bin sections) are invalid because they are missing a
parameter. You have "ScriptAlias /cgi-bin/" but they should be
"ScriptAlias /path/to/dir/ /cgi-bin/" where "/path/to/dir/" should
probably be "/srv/www/cgi-bin/" to match your Directory sections.

Until you fix that Apache won't start.

HTH.
--
Simon
SUSE Knowledge Partner

------------------------------------------------------------------------
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.
------------------------------------------------------------------------

tarzy
21-Sep-2013, 02:37
Well, I'm almost done; it will be somewhat apparent as to my shortcomings looking at the restart command the first time.....even I know there's no trailing slash between a service and an issued command!

************************************************** ************************************************** ************************************************** ********************************************
linux-2u6o:~ # /etc/init.d/apache2/ restart
bash: /etc/init.d/apache2/: Not a directory
linux-2u6o:~ # /etc/init.d/apache2 restart
[Fri Sep 20 18:17:32 2013] [warn] VirtualHost playguitarvideos.com:0 overlaps with VirtualHost craigtarwater.com:0, the first has precedence, perhaps you need a NameVirtualHost directive
Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) [Fri Sep 20 18:17:33 2013] [warn] VirtualHost playguitarvideos.com:0 overlaps with VirtualHost craigtarwater.com:0, the first has precedence, perhaps you need a NameVirtualHost directive
done
************************************************** ************************************************** ************************************************** *********************************************

It works, now it appears I need to address the warning as to precedence and another boggle for me: "named directive". So far, this is convincing me not to use YaST for the server, as I started with it; albeit not truly knowing what I was doing! Off for some searching.......




Thnaks much; I now have what you specified as my only error:

linux-2u6o:~ # /etc/init.d/apache2 start
Starting httpd2 (prefork) Syntax error on line 23 of /etc/apache2/vhosts.d/ip-based_vhosts.conf:
Multiple <Directory> arguments not (yet) supported.

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf failed


I have learned something here, to a degree, which is that I will need to take the time to delve into and understand the command-line procedures, and what is and is not. I see where the /srv/www/cgi-bin/ /cgi-bin/ stopped the previous error. The new one above supports your observation of "duplicate directories". So I have assumed that each virtual host needed what's written here, but obviously not.
************************************************** ***************
<VirtualHost playguitarvideos.com>
DocumentRoot /srv/www/htdocs/pgvdotcom
ServerName playguitarvideos.com
ServerAdmin admin@playguitarvideos.com
<Directory /srv/www/htdocs/pgvdotcom>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /srv/www/cgi-bin/ /cgi-bin/
<Directory /srv/www/cgi-bin>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
UserDir public_html
</VirtualHost>
<VirtualHost craigtarwater.com>
DocumentRoot /srv/www/htdocs/ctdotcom
ServerName craigtarwater.com
ServerAdmin admin@craigtarwater.com
<Directory /srv/www/htdocs/New Folder>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /srv/www/cgi-bin/ /cgi-bin/
<Directory /srv/www/cgi-bin>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
UserDir public_html
</VirtualHost>
************************************************** *****************************

So the entire ip-based.conf only needs a single ScriptAlias then, correct? (I am doing this slowly BTW, as I'm up to my eyeballs in many tasks besides this new machine)

Regards. tarzy

tarzy
21-Sep-2013, 22:10
I have Webmin installed and will not be using YaST to do any work with the server from this point onward. I spite of the CLI warning as to the named virtualhost directive, I believe I can resolve it simply, and that is by imitating the Lion's share of my old Fedora server (ie; copying what's relevant and experimenting with the remainder).

I have yet to acquire forum skills, but I'm needing some MySQL info pertaining to copying some existing content on the old server to this new one. I would appreciate where I should be posting these questions within this forum, and meanwhile, I'll look to see if I can locate the correct place.

One thing I don't know is how to close this thread (am trying to find it), as my server is running now. I have a major amount of work to do before I can assign it to port 80 (digital goods delivery, etc.).

KBOYLE
22-Sep-2013, 00:22
tarzy wrote:

>
> I have Webmin installed and will not be using YaST to do any work with
> the server from this point onward. I spite of the CLI warning as to
> the named virtualhost directive, I believe I can resolve it simply,
> and that is by imitating the Lion's share of my old Fedora server
> (ie; copying what's relevant and experimenting with the remainder).

Yast makes some things much easier but often it won't allow you to
configure all aspects of a component. In those cases you'll want to
edit the config file yourself. As a precaution, make a backup copy
after you are finished just in case it should get overwritten should
your system be reconfigured.


> I have yet to acquire forum skills, but I'm needing some MySQL info
> pertaining to copying some existing content on the old server to this
> new one. I would appreciate where I should be posting these questions
> within this forum, and meanwhile, I'll look to see if I can locate the
> correct place.

If it's SLES related, you can post here otherwise you can try the MySQL
forums: http://forums.mysql.com/


> One thing I don't know is how to close this thread (am trying to find
> it), as my server is running now.

That's easy: We don't close threads in these forums.


> I have a major amount of work to do
> before I can assign it to port 80 (digital goods delivery, etc.).

Well, have fun and remember we are here if you need us.

--
Kevin Boyle - Knowledge Partner
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

jmozdzen
25-Sep-2013, 12:01
Hi tarzy,

although you've gone a different path by now, I just wanted to follow up for the sake of later visitors of this thread:


Thnaks much; I now have what you specified as my only error:

linux-2u6o:~ # /etc/init.d/apache2 start
Starting httpd2 (prefork) Syntax error on line 23 of /etc/apache2/vhosts.d/ip-based_vhosts.conf:
Multiple <Directory> arguments not (yet) supported.
[...]
<VirtualHost playguitarvideos.com>
[...]
<VirtualHost craigtarwater.com>
DocumentRoot /srv/www/htdocs/ctdotcom
ServerName craigtarwater.com
ServerAdmin admin@craigtarwater.com
<Directory /srv/www/htdocs/New Folder>


The error is caused by the missing quotes around the directory name... hence the blank is treated as a parameter separator, making it a "Directory" statement with two (instead of the only allowed one) parameters.


<Directory "/srv/www/htdocs/New Folder"> would have been correct.

I strongly suggest against using folder names containing blanks... there's more than one place they will cause trouble, if not handled correctly.

Regards,
Jens