I have done the following checks:
shebang line
file extension .cgi
script is executable
restarted apache
I've done the following in my project.conf file on Vagrant under /sites-enabled:
<Directory /var/www/perl_project/cgi-bin>
Options ExecCGI
SetHandler cgi-script
</Directory>
I'm pointing to http://project.local/cgi-bin/routes.cgi?page=reports in my links, but they bring up the text of the script and don't run them...
The script isn't displaying any HTML, it is a kind of router where I get query string and based on that load a template toolkit file
could someone please help?
I placed my cgi scripts under /usr/lib/cgi-bin
After installing the mod_cgi module I noticed a /cgi-bin directory was created under /vagrant, but that didn't work for some reason so I hunted down the former cgi-bin directory.
Hope this helps someone
Related
If I add Options +Indexes in .htaccess this will display all files and subdirectories. However, I would like to exclude files for the current directory. i.e. display directories only for the current directory and display files and directories for any subdirectories.
Is this possible in .htaccess or will I need to write my own script to generate the directory index?
According to the comment of CBroe above, I've maked this approach tested in debian apache2 in .htaccess:
Options +Indexes
IndexIgnore *.*
This will ignore files with a file extension such as file.html. As we usually not name a directoty with a dot extension, so directories will be shown.
Please consult also apache autoindex reference http://httpd.apache.org/docs/2.4/mod/mod_autoindex.html .
So I have a Laravel 5.2 project on GitHub that works perfectly on my localhost using MAMP. Now I want to deploy that project in Digital Ocean. I've used a LAMP stack and configured everything (I think). Phpmyadmin is installed as well.
I followed most of the steps highlighted in this article: http://davidmyers.name/post/laravel-on-digital-ocean but some don't apply since I think its for Laravel 4 because the Laravel 5 structure is different.
I ran composer install after cloning the repository to install the dependencies
I created the .env file to include the MySQL database info on the DO Server.
I ran the following two commands to change permissions on the project folder:
sudo chmod -R gu+w www and sudo chmod -R guo+w www
Now I am able to see the public Laravel HomePage without issues:
However, when I try to access the different API routes that have been defined in the local version I have running, I get a 404 Error on the page:
Any idea what might be causing this issue?
Thanks in Advance!
I found the answer to my issue on this thread: https://laracasts.com/discuss/channels/laravel/why-do-i-always-get-a-404-error-for-any-route-i-create?page=1
Basically I needed to modify my apache settings on the conf file. My conf file was located here: /etc/apache2/sites-available/000-default.conf
I modified that file to include this:
<Directory /var/www/yoursite.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
After I modified that, the routes now work perfectly.
Sounds like a rewrite problem. Did you setup the .htaccess files correctly in the root and in the public folder of your project?
I'm running a Yii app with Wampserver, I pulled it from a git repository so it had no assets folders, I had to manually create each one because it was throwing a CException.
Now when I load any page Yii creates some folders with random names inside my assets folders, but they're all empty. Edit: Just noticed one of the folders created is full of files, but the other is totally empty and that's where it is trying to load all bootstrap files.
I've tried deleting them again but I have the same result, also tried adding SAFE_MODE in php.ini, running wamp as admin and adding this in the apache conf:
<Directory "*/assets/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I read the 'Understanding assets' post but the only useful thing I found was:
It's important that the directory be writable by the webserver user so
that Yii can publish the resources there when needed
Yet I can't find how to do it for Wampserver
So, what am I supposed to do?
Thank You
I just found out what was going on, the application is using a bootstrap component which has an "assets" folder as well, since git was ignoring that folder it was empty and the component wasn't able to publish the files in the application assets. I just put the original component files inside that folder and the problem is now solved.
How to set PATH for Apache server on a per-directory basis?
Problem: I have a system in which I can not change the
system installed python in /usr/bin/.
I have a bunch of python cgi scripts that all have
#!/usr/bin/env python
as their first line. I strongly prefer not to change
these scripts for logistical reasons.
But these scripts require a different version of Python
than the system installed one. I have the right version
installed in /opt/python/bin/. So if I could put this
directory at the front of PATH, but only for this particular
cgi directory, it would solve my problem.
That is, if the following would work, it would do what I want.
ScriptAlias /mydir/cgi/ /home/me/devel/cgi/
<Directory /home/me/devel/cgi>
SetEnv PATH /opt/python/bin:/usr/bin:/bin
...other stuff...
</Directory>
But it seems SetEnv does not work on PATH (at least on Apache 2.2).
Is there some other way to changing PATH for just one
particular directory in Apache?
(P.S., I also tried SetEnvIf without any joy.)
I've searched for this for a while but have not been able to find a solution. How can I configure Apache to run any ELF executable in the web root as a CGI program? For example, if I write and compile a C program and place it as /var/www/something, I want to be able to visit http://localhost/something and have Apache run the program, outputting the result, instead of prompting me to download the binary.
Edit: I know how to run CGI programs, and those outside of cgi-bin, I just want to find out how to run ELF executables with no extension such as .cgi, possibly using Apache to detect the magic of the file.
How about using the files directive to whitelist your executable names?
<files something>
SetHandler cgi-script
</files>
Or better, can you put all your executables into a single known subdirectory?
<location /exec>
SetHandler cgi-script
</location>