I am trying to run my first Perl Catalyst application using Apache and fastcgi.
Starting the server is fine, I can see the application's main page. All images/javascripts are loaded correctly (so, I assume the static content is served correctly).
For reasons I don't understand the dynamic content gives me a 404: e.g. when trying to go to www.webapp.org/search, I get "The requested URL /search was not found on this server."
Ok, here is how I set the aliases for the static content and
Alias /static /webapp/root/static/
Alias / /webapp/script/webapp_fastcgi.pl
I set the documentroot with
DocumentRoot /webapp/
Furthermore, I have a
<Location />
Options +ExecCGI
Order allow,deny
Allow from all
AddHandler fcgid-script .pl
</Location>
and a directive
<Files /webapp/script/webapp_fastcgi.pl>
PassEnv PERL5LIB
SetHandler fastcgi-script
</Files>
There is nothing else in the config file.
How can I add a directive to allow serving dynamic content (www.webapp.com/search)?
Thanks a lot in advance!
I see a space in AddHandler section. Please check your config file for typo's.
AddHandler fcgid-script .pl
Also please read this if you not did it already:
http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi
For development work you could use catalyst without apache hassle: http://search.cpan.org/~mramberg/Catalyst-Runtime-5.80012/lib/Catalyst/Engine/FastCGI.pm#Standalone_FastCGI_Server
Assuming apxs installed mod_fastcgi.so into /usr/local/apache/libexec, add the following to an Apache .conf file:
LoadModule fastcgi_module libexec/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiExternalServer /tmp/myapp.fcgi -host myhost:8081
Alias /myapp/ /tmp/myapp.fcgi/
</IfModule>
Related
I have an environment with Oracle WebLogic and OHS running.
In the mod_wl_ohs.conf I have following (beside config for other applications)
<Location /application1>
SetHandler weblogic-handler
WLLogFile /opt/logs/ application1.log
Debug OFF
WebLogicHost 127.0.0.1
WebLogicPort 23666
</Location>
This works fine the and the server listening to 23666 with the actual application1 application is handling the requests like “http://example.com/application1/*” .
Now I would like to redirect all requests for specific URL pattern to a different domain (not necessary on the same server), but continuing handling all requests others.
Redirect: http://example.com/application1/MagicKeyword/*
continue on: http://example.com/application1/NotTheKeyword* or http://example.com/application1/AlsoNotKeyword/*
What is the right approach for that?
I played around with some mod_rewrite rules, it seems they don’t take affect or break everything (in httpd.conf). I was also reading that we should not use mod_rewrite rules inside of location tag (can't find the reference now).
What else can I do?
Edit: So finally I found my error (somehow wrong syntax which not prevented the server from starting (like usual).
So I could:
in httpd.conf
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule "(.*)/application1/MagicKeyword/(.*)$" "https://www.example.org" [NC,L,R=301]
</IfModule>
or in the Location tag add:
RewriteEngine On
RewriteRule "(.*)/MagicKeyword/(.*)$" "https://www.example.org" [NC,L,R=301]
Why should I prefer one over the other?
Is there anything to concern about?
Two other options you can consider. You can use the order of location tags:
<Location /application1/MagicKeyword>
WebLogicHost otherhost
</Location>
<Location /application1>
WebLogicHost 127.0.0.1
</Location>
You can tell WebLogic to exclude a path (see https://docs.oracle.com/middleware/1212/webtier/PLGWL/plugin_params.htm#PLGWL473):
<Location /application1>
WebLogicHost 127.0.0.1
WLExcludePathOrMimeType /application1/MagicKeyword
</Location>
<Location /application1>
WebLogicHost otherhost
</Location>
as admin, when trying to edit product description, using TinyMCE to insert an image -
when trying to save the new description I get server error.
I followed recommendation from - https://www.prestashop.com/forums/topic/317986-after-upgrade-to-16-i-cant-add-images-in-the-editor-i-get-a-litle-square-with-a-black-x-black/
and I removed \img\cms.htacces
and indeed the problem was solved and now I can save product description with image.
but according to - https://www.prestashop.com/forums/topic/316255-cms-images-cant-be-displayed-unless-htaccess-file-is-deleted/
I now have a security problem.
so what should be .htaccess content? or is there another solution for TinyMCE problem?
my \img\cms.htacces file:
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
deny from all
<Files ~ "(?i)^.*\.(jpg|jpeg|gif|png)$">
order deny,allow
allow from all
</Files>
Can you try with this file?
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
Require all denied
<Files ~ "(?i)^.*\.(jpg|jpeg|gif|png)$">
Require all granted
</Files>
Since Apache 2.4 mod_access_compat has been replaced by mod_authz_host.
Here is an upgrading documentation
I've installed Zend Framework, and I've created my project "zendy" to the path: D:\wamp\www\zendy. So I modified the file "httpd.conf" (I use WAMPSERVER) by adding:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName zendy
DocumentRoot D:\wamp\www\zendy\public
<Directory D:\wamp\www\zendy\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And then I restarted all the services of WAMPSERVER. I add a line "127.0.0.1 zendy" in the file C:\Windows\System32\divers\etc\hosts
Then I type "zendy/" or "localhost" in my navigator but it displays something like:
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request."
I totally follow the tutorial for installing zend frameline like :
http://www.youtube.com/watch?v=m7svJHmgJqs and http://framework.zend.com/manual/en/learning.quickstart.create-project.html
Who can help me?? Thanks a lot!!
Verify virtual configuration syntax using “httpd -S”
Also find something like this in httpd.conf and uncomment it by removing the preceding # sign before Include
#Virtual hosts
Include conf/extra/httpd-vhosts.conf
Please don't remove the # sign before Virtual hosts as depicted above.
Also, add
Options Indexes FollowSymLinks
before
AllowOverride All
and restart wamp
Here is the correct configuration:
<VirtualHost *:80>
ServerName zendy
DocumentRoot D:\wamp\www\zendy\public
</VirtualHost>
You do not need to mention directory under this.
Try and revert! :)
PS: Also, check for AllowOverride in your main httpd.conf or apache2.conf file. Hope it helps!
I have a really strange behavior while using Mason, for example:
I have an index.html file ( that contains mason tags like <% $var %> hello ).
When I'm browsing to http://bla.com/index.html the variable is translated during compilation.
But there's a strange behavior when I'm browsing to http://bla.com/index.
Though there's no file called index (only index.html) it still loads index.html and the entire code is shown as plain/text including the <% ... %> !!!
What have I configured wrong ?
this is my Apache configuration:
<VirtualHost *:80>
ServerAdmin webmaster#abc.com
ServerAlias abc.com www.abc.com
ServerName abc.com
DocumentRoot /var/www/abc.com
DirectoryIndex index.html
<Directory "/var/www/abc.com/">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
SetHandler perl-script
PerlModule HTML::Mason::ApacheHandler
PerlSetVar MasonUseObjectFiles 1
<LocationMatch "(\.html|\.txt|\.pl|\.js)$">
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
</LocationMatch>
<LocationMatch "(\.m(html|txt|pl)|dhandler|autohandler)$">
SetHandler perl-script
PerlHandler Apache::Constants::NOT_FOUND
</LocationMatch>
After a ~year I accidently found the answer, so I wanted to share my findings:
The problem was that Mason(Perl) displaying the code itself of another file on the web instead of providing "404 file not found" and I had no idea how to stop it. e.g: when requesting index it shows the code of index.html
The solution is that in my Apache configuration there was the following:
<Directory "/var/www/my_dir/">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Apparently "MultiViews" is activated through mod_negotiation.c, which cause the site to search for a pattern of the next-best match in-case the file is not found on the server. ( so from www.site.com/index it found index.html )
But because there's no configuration in the Apache to execute /index in Mason ENV ( no file extension ) , it simply displayed the code ...
Funny :) but the solution was to change "Options FollowSymLinks MultiViews" to "Options FollowSymLinks -MultiViews" and not using the MultiViews.
Found this solution while seen the following response headers:
Content-Location index.html
Vary negotiate
The "MultiViews" doesn't have any meaning to me, as it was a copy-paste from a 5 years ago that I simply carried from one web-server to another :)
Thanks,
Ricky.
Why the webserver automagically
translates index into index.html
still insists on treat it specially (it apparently don't feed it into the PerlHandler as it should) I honestly don't know (perhaps the answer is elsewhere in your configuration).
However, you could as a work around try to add 'index' (or perhaps rather'^index') to the regex that defined what files should be dispached to HTML::Mason::ApacheHandler. I do admit it is a bit ugly though.
Am I correct that once you load the index page and get that verbatim code displayed, once you check out the page info, the encoding is literally plain/text? Perhaps you need to configure some mime settings to ensure that files without suffixes (files not ending with .html etc) are not sent to the remote browser at all, not even as plain/text?
I have perl installed on the server and working fine, but I can't get Apache to serve anything with fastcgi/suexec installed. Below is an example of one of my Apache vhost configs without perl as I can't get anything in there to work with perl:
<VirtualHost example.example.example.example:80>
ServerName example.com
ServerAdmin webmaster#example.com
DocumentRoot /home/user/public_html
SuexecUserGroup username username
ScriptAlias /php-fastcgi/ /home/user/php-fastcgi/
FCGIWrapper /home/user/php-fastcgi/wrapper .php
AddHandler fcgid-script .php
Options ExecCGI Indexes
<Directory /home/user/public_html>
Options -Indexes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/user_error.log
LogLevel warn
CustomLog /var/log/apache2/user_access.log combined
IIRC, you need to use:
use FCGI;
in your Perl script and code with FastCGI in mind. More info can be found here: http://www.fastcgi.com/devkit/doc/fastcgi-prog-guide/ch3perl.htm
The SuexecUserGroup entry looks right and /should/ be all you need to do. At least, it works on my VPS running RedHat.