CGI working directory (trying to load a template file) - apache

I have a CGI-script which tries to load a template file. However, I get an error where the file location of the CGI-script itself is added to the path where I try to load the template:
let template_string = Jg_template.from_file "/home/d37433/templates/startpage.tmpl" in
Error:
file /home/d37433/public_html/cgi-bin//home/d37433/templates/startpage.tmpl not found
Is there an error in my Apache config? The same code worked on another machine of mine (unfortunately, I don't have access to it at the moment).

Solved by programmatically change the working directory inside the CGI script.

Related

Why is my ProxyPass and uWSGI not connecting?

I am trying to get a python environment live for a Django project and it's fighting me. I have installed mod_proxy_uwsgi through EasyApache4 (mod_proxy was already on). I have added the following include in the Apache include editor under pre-virtual host (Versioned):
include /etc/apache2/conf.d/userdata/std/2_4/user/domain/proxy.conf
with the following content:
ProxyPreserveHost On
ProxyPass "/" "unix://localhost/var/run/swerth_django.sock"
ProxyPassReverse "/" "unix://localhost/var/run/swerth_django.sock"
I have used YUM installer to install uWSGI and run using a .ini file (command:uwsgi --ini php.ini) with the following content which is executing fine so far (no error messages):
[uwsgi]
chdir=/home/swerth/public_html/mysite
module=mysite.wsgi:application
env=DJANGO_SETTINGS_MODULE=mysite.settings
master=True
pidfile=/tmp/project-master.pid
socket=127.0.0.1:49152
processes=5
harakiri=20
post-buffering=1
max-requests=5000
vacuum=True
home=/home/swerth/public_html/Swerth.VirtualEnv
Despite all this, it's still not working. My Django project still isn't serving. I have a sneaky suspicion that there's something I don't understand about these systems and reverse proxying. Is there something I'm missing or messing up?
Ok, so turns out I was adding my Include function under the versioned part of the includes editor and it needed to be added under the global one because of how the includes editor adds the files to the main httpd.conf file (versioned wasn't being included into the main httpd.conf for some reason)

Angular CLI routing - Doesn't work on (Apache-) Server

I'm currently learning Angular-CLI for a Project. I succeeded in creating a simple little project with some routing Objects. In dev mode with ng serve, everthing works just fine. I can call the localhost:port in the browser and it works with the routing.
.
After a successful ng build -prod and moving all the stuff from the dist directory into my Server Folder (Apache24/htdocs), I start my Server and the main Side (mywebside) just works fine, the routing however does not... (i.e. localhost/about), instead I get a standart Error-Page as shown below:
Hope I was able to describe clearly what I did and where my problems are. I didn't posted any Code because I think the problem has to be else where.
Thank you for your help!
Manuel
Versions:
angular CLI: Beta.8 (latest)
(apache): 2.4.20
OK figured it out (with help from PierreDuc!)
You have to do 2 things:
add a .htaccess file: (just like that no filename!) in the folder where your index.html File is saved, insert this code:
ErrorDocument 404 /index.html
Edit the httpd.conf:
(you find the File in the Apache24/conf/ directory) search for the line:
<Directory "c:/Apache24/htdocs"> [...] -> in my Version of apache it is in line 244
a few lines further (after a few comments) you should find this line:
AllowOverride none -> in my Version of apache it is in line 264
change this line to
AllowOverride ALL
Thats it, now your Angular-CLI Website should work in the production build with routing objects
hope it might be helpful to other Developpers!
Thanks to PierreDuc!
Manuel

Loading a module to Apache

I am currently trying to load a module to Apache, build using cmake. The module is called mod_mapcache. It is built successfully and installed correctly in /usr/lib/apache2/modules directroy.
I am using Ubuntu. So I created a new file called mapcache in /etc/apache2/conf.d folder. And wrote
LoadModule mapcache_module modules/mod_mapcache.so
<IfModule mapcache_module>
<Directory /usr/lib/apache2/modules>
Order Allow,Deny
Allow from all
</Directory>
MapCacheAlias /mapcache "/home/mwh/mapcache/mapcache.xml"
</IfModule>
But when I restart the server error generates telling the file is not there. What am I doing wrong in here?
apache2: Syntax error on line 234 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/conf.d/mapcache: Cannot load /etc/apache2/modules/mod_mapcache.so into server: /etc/apache2/modules/mod_mapcache.so: cannot open shared object file: No such file or directory
Action 'graceful' failed.
It is built successfully and installed correctly in /usr/lib/apache2/modules directroy.
and
Cannot load /etc/apache2/modules/mod_mapcache.so into server: /etc/apache2/modules/mod_mapcache.so: cannot open shared object file: No such file or directory
The module isn't installed where the Apache expects it as per configuration.
So you might like to change the module's configuration to be:
LoadModule mapcache_module /usr/lib/apache2/modules/mod_mapcache.so

open_basedir restriction when parsing LESS files

I got a warning when parsing my "Twitter BootStrap" files and saving them on disk in my less-cache folder.
Warning: is_file(): open_basedir restriction in effect. File(/../../lib/bootstrap/less/reset.less.less) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/httpdocs/wp-content/modules/wp-less/lessc/lessc.inc.php on line 80
I'm using (for example) #import "../../lib/bootstrap/less/reset.less"; in the main file that I'm parsing.
The funky thing is, that the first stylesheet gets the extension two times: reset.less.less - the other ones not. Another thing that keeps me wondering, is why the heck there's a leading / in front of the files.
Some data about the environment and server:
PHP 5.3.3
Wordpress 3.4.2
The WP-LESS Plugin (yes, I commit to this repo), which uses the LESSc library - which throws the error from here.
php.ini
include_path = ".:..:"
upload_temp_dir _no value/not set_
open_basedir = "/var/www/vhosts/example.com/:/tmp/"
Thanks for any help in advance!

Ploblem including a file- Titanium

I get an error while i try to include the js file which is in the same folder. I tried cleaning my project but was of no use.
The console says "error loading path".
Please help.
var db={}
Titanium.include('windows/gallery');
var displayButton= Ti.UI.createButton({
title:'Display',
onClick:function(){
db.gallery.open();
}
});
I have used open function which opens the file. The open file works has no problem.
usually, we use require('files/myFile'), where :
Resources/files/myFile.js is the path (note that require doesn't use the .js)
The js file is NOT at the same level that app.js, but included in Resource folder.
So here, you should do
Titanium.require('windows/gallery');
instead of
Titanium.include('windows/gallery');
By the way, the previous method was Titanium.include('windows/gallery.js');
Note the .js at the end of the include version.
Is it a mobile or desktop version ?