Why is my ProxyPass and uWSGI not connecting? - apache

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)

Related

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

apache ssi include with file abc.inc fails (abc.html, abc.txt, abc.xxx, abc.INC works fine)

apache 2.2.15, +Includes in directory container and XBitHack Full
somefile.html has line <!-- #include file="abc.inc" -->
This include fails with "unable to include "abc.inc" in log
If I change the extension of the file (and the include statement) to virtually anything (e.g. abc.xxx, abc.txt, abc.html, even abc.Inc or abc.INC) everything works fine. ONLY abc.inc fails
I've looked for definitions of inc in mime.types, grep'ed everything in the httpd conf files/directories.
Not a huge problem but it's got me curious.
thanks

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!

Apache; Phusion Passenger 3 RackBaseURI works only in Production environment for Rails 3

I have a few rails 3 applications which run under their own Rails/Rack BaseURI.
Under Passenger 2 I was using RailsBaseURI to "mount" individual rails apps under a single domain; this worked normally. I upgraded to Passenger 3.0.2 and now when I'm running in development mode my Rails 3 apps want to prepend AND append the baseURI, but only in the development environment. Under production, all is well.
For example:
App lives in /fsroot/otherdir/myapp
Target file lives in /fsroot/otherdir/myapp/public/path/to/asset.css
in vhost config:
RackBaseURI /myapp
Note:symlink in virtualhost DocumentRoot is named myapp and pointed to /fsroot/otherdir/myapp/public
In a view:
stylesheet_link_tag '/path/to/asset.css'
will produce
No such file or directory - Asset file not found at '/fsroot/otherdir/myapp/public/myapp/path/to/asset.css'
Note that the RackBaseURI shows here before and after the public folder.
I tried copying the development.rb environment file over to production.rb and rebooting apache but it does the same thing. There is apparently some other directive which is being assumed in each of these environments but I have no idea what it would be. I tried using RailsBaseURI and RackBaseURI but both behaved identically.
Rails 3 Wizard guidance is appreciated.
While I'm not sure, this may help:
replace RailsBaseURI with RackBaseURI if you’re using Rails 3 with Passenger 3
source:
http://wiki.railsplayground.com/railsplayground/show/How+To+use+Phusion+Passenger

Configure EasyPHP to use CGI

I'm trying to modify my EasyPHP to run in CGI mode.
According to this link: http://www.easyvitools.com/phpserial/php_ser_reference.html
I have to add in this line:
LoadModule php5_module "C:/Program Files/EasyPHP 2.0b1/php5/php5apache2.dll" to httpd.conf
However, everytime I do that, EasyPHP gives me this error:
Error in Apache configuration file:
""apache.exe: syntax error on line 126
of ..../apache/conf/httpd.conf. API
module structure 'php5_module' in the
file C:..../php5/php5apache2.dll is
garbled - perhaps this is not an
APache module DSO?""
I've checked that the file php5apache2.dll exists and that it is correct in the config file. Does anybody know what could cause this problem or am I doing something wrong to change it to CGI mode instead of using the default APache handler?
I believe that you may need to re-read the instructions:
Comment this line:
#LoadModule php5_module "c:/Php/php5apache2.dll"
And add 2 new lines:
ScriptAlias /php/ "c:/php/"
Action application/x-httpd-php "/php/php-cgi.exe"
So it appears that the line you are adding actually needs to be commented out / removed. And you need to use these alternative directives in httpd.conf.