I have a grails app running on a tomcat server that is pointed to by apache 2.2 http server. Using mod_jk I've gotten it to work using myapp.com:9090 to get to the app. However myapp.com just gives me 503 with the error:
"Could not reliably determine the server's fully qualified domain name, using 193.xx.xxx.xxx for ServerName."
But this is the only error I get.
The virtual host looks like this:
<VirtualHost 193.xx.xxx.xxx:80>
ServerName www.myapp.se
ServerAlias myapp.se
DocumentRoot "D:/apache-tomcat-7.0.5/webapps/ROOT"
JkMount /* worker1
</VirtualHost>
In the httpd.conf i load the module like this:
# Load module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel emerg
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
And the workers.properties looks like this:
workers.tomcat_home="D:/apache-tomcat-7.0.5"
workers.java_home="C:/Program Files/Java/jdk1.6.0_22"
ps=/
worker.list=worker1
worker.worker1.port=8010
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
Have you tried mod_proxy_ajp? I have a Grails app in production that uses Apache 2.2, Tomcat 6x, Grails 1.3.7 with Apache proxying to Tomcat w/o issue using mod_proxy_ajp. If you're not restricted to using mod_jk, I recommend giving this a try. And I have this working on Centos 5.5, Ubuntu 10.4LTS and Win2k3 environments, FYI.
Related
I've encountered an issue that is preventing me from starting my Ruby on Rails application on our Production server despite it running correctly on both Development and Staging environments. The error message is as follows:
[ E 2021-04-26 14:53:39.4216 14896/T11 age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /path/to/application: The application encountered the following error: No such file to load -- /path/to/application/app/config/environment.rb (LoadError)
For some reason Passenger is attempting to find the config/environment.rb inside of an app folder when instead it should just be looking for:
/path/to/application/config/environment.rb
Passenger is being configured using Apache and the site config can be seen below:
<VirtualHost *:80>
# PassengerFriendlyErrorPages on
# PassengerStartTimeout 90
ServerAdmin email#example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DocumentRoot /path/to/application/public
<Directory /path/to/application/public>
AllowOverride None
Options -Multiviews
Require all granted
</Directory>
</VirtualHost>
PassengerPreStart http://localhost
PassengerAppEnv production
PassengerLogFile ${APACHE_LOG_DIR}/passenger.log
The server is running Ubuntu 18.04. I've included what I think are the relevant versions below:
Ruby - 2.5.1
Ruby on Rails - 5.2.5
Passenger - 6.0.7
Does anyone know what config I may be missing that is causing Passenger to be looking in the wrong place?
look .. i read about passenger , i am beginner to ruby ;"beginner"= when i remember about ruby,python i download them and i try to compile them to exe to find out if they changed things = .exe smaller or for the another alternative of compilers i usually use ..
today's test was in ruby + apache + php 8.1 as testing a output from a http://localhost/test/ and without any compilation (this isn't the answer to your question but if anyone needs this new point of view and you use php and ruby always ..)
in windows with apache ,php ,.. and ruby installed , in your htdocs create test folder and put these into it:
index.php
<?php
// Highest priority
proc_nice(-20);
echo shell_exec('index.rb');
//system('index.rb');
?>
index.rb
#puts "Content-type: text/html\r\n"
puts "Hello World" + "<br>"
time1 = Time.new
puts "Current Time : " + time1.inspect + "<br>"
# Time.now is a synonym:
time2 = Time.now
puts "Current Time : " + time2.inspect + "<br>"
now open the browser and go to http://localhost/test/
then if you click refresh or you hit f5 key(refresh) in your bowser after the first results then the time shoul display the refresh values
One of my website clients had issues while placing orders.
When I checked my error log I could see this :
[warn] mod_fcgid: read data timeout in 45 seconds, referer: https://myDomain/cart
[error] Premature end of script headers: index.php, referer: https://myDomain/cart
What does this error mean? What should I do to eliminate this error? Are there any settings to be changed in Plesk Control panel? will it be solved if I change 'max_execution_time' in 'Php settings' to 3600?
I am using Plesk 12.0.18, CentOS 5.11
The error means that website code in index.php file fails to be executed in the time limit, which set for Apache FastCGI module and/or PHP.
Most likely, there is an error in the index.php, which makes it inoperable at all. In this case, you should increase the PHP error reporting level in Plesk > Domains > example.com > PHP Settings and review the script itself.
Less likely that script is meant to take a long time to execute. In this case, you may simply increase timeout via Plesk. To set 120 seconds instead of default 45, do the following:
1. Set max_execution_time to 120 in Plesk > Domains > example.com > PHP settings.
2. Increase FastCGI timeout by adding the following Apache dirctives in Plesk > Domains > example.com > Apache & Nginx settings > Additional Apache directives:
<IfModule mod_fcgid.c>
FcgidIOTimeout 120
</IfModule>
I'm trying to use Faye gem on thin server with Rails in a production environment but I cannot make it work. I'm using apache 2.4 and ws_tunnel also proxy modules are enabled. My setup is like below.
Apache configuration
<VirtualHost *:443>
ServerName mysite.example.com
ServerAlias mysite.example.com
DocumentRoot /var/www/html/mysite/current/public
SSLEngine on
SSLCertificateFile "/etc/httpd/conf/keys/ServerCertificate.cer"
SSLCertificateKeyFile "/etc/httpd/conf/keys/example.com.key"
SSLCertificateChainFile "/etc/httpd/conf/keys/CACertificate-1.cer"
RewriteEngine On
SSLProxyEngine On
ProxyRequests off
ProxyPreserveHost on
ProxyPass /faye !
ProxyPassReverse /faye !
ProxyPass / balancer://thinservers/
ProxyPassReverse / balancer://thinservers/
<Proxy *>
Require all granted
</Proxy>
<Location /faye>
ProxyPass ws://localhost:9292
ProxyPassReverse ws://localhost:9292
</Location>
RequestHeader set X_FORWARDED_PROTO 'https'
# Custom log file locations
ErrorLog /etc/httpd/logs/error-unilever.log
CustomLog /etc/httpd/logs/access-unilever.log combined
</VirtualHost>
Faye.ru file
require 'faye'
Faye::WebSocket.load_adapter('thin')
app = Faye::RackAdapter.new(:mount => '/faye', :timeout => 25)
run app
And I'm starting faye with the following command
rackup faye.ru -E production -s thin
This way I can reach the faye.js by typing the following url from the browser.
https://mysite.example.com/faye/faye.js
But When I type https://mysite.example.com/faye/ for example, I get the following result
Sure you're not looking for /faye ?<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
root#localhost to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>
which is strange because I only get "Sure you're not looking for /faye ?" in the development.
I'm calling the Faye in application.js as
client = new Faye.Client("https://mysite.example.com/faye/faye")
And I get an error like
POST https://mysite.example.com/faye/faye 400 (Bad Request)
I also tried to use the wss protocol in the proxy settings and also giving my certificate paths to thin to start with SSL but nothing worked.
I assume this may be happening because of the proxy or the ws_tunnel module because when I run the following command from the shell in the server
curl http://localhost:9292
I get only "Sure you're not looking for /faye ?" message.
Does anyone came accross something like this?
I would appreciate if someone could help me.
Thanks in advance.
For those who's having the same issue, my advice is to no matter which version of Apache you are using, just change it to nginx without any hesitation. It's been very easy to configure and run it.
I'm using the below configuration for my app named example. After setting up nginx correctly, everything else worked quite well.
hope this helps someone
# app: example
# locally running on port 7000
upstream example {
server 127.0.0.1:7000;
server 127.0.0.1:7001;
}
# Faye is set to run on port 9292
upstream example_socket{
server 127.0.0.1:9292;
}
server {
# listen 80 if it's a non SSL site
listen 443;
server_name www.example.com;
location /faye {
proxy_pass http://example_socket;
# Including common configurations
include /etc/nginx/conf.d/proxy.conf;
include /etc/nginx/conf.d/proxy_socket.conf;
}
location / {
root /var/www/vhost/example/current/public;
proxy_pass http://example;
# Including common configurations
# can be found on Internet easily
include /etc/nginx/conf.d/proxy.conf;
}
}
I own the domain, "peterlee.com.cn", and I added an A Record in my domain control panel:
RR Destination IP TTL
rs.peterlee.com.cn 10.50.10.75 1 hour
I have an RoR (Ruby on Rails) project running on 10.50.10.75:9051, which means the user can visit my RoR application by http://10.50.10.75:9051
I want to let the user visit it by http://rs.peterlee.com.cn, so I added the following VirtualHost File/Site:
<VirtualHost *:80>
ServerName rs.peterlee.com.cn
DocumentRoot /usr/website/myapp/current/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:9051/
ProxyPassReverse / http://127.0.0.1:9051/
RackEnv production
RailsEnv production
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect all requests to the maintenance page if present
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
</IfModule>
</VirtualHost>
After enabling the site and restarting the Apache2, I tried http://rs.peterlee.com.cn, it gives me the 500 Internal Server Error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.22 (Ubuntu) Server at rs.peterlee.com.cn Port 80
Thanks.
Peter
I found the following warning in /var/log/apache2/error.log:
[Thu Jul 19 10:22:20 2012] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[Thu Jul 19 10:22:20 2012] [warn] proxy: No protocol handler was valid for the URL /favicon.ico. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
So I enable the following modules:
sudo a2enmod proxy proxy_balancer proxy_http
After restarting Apache2, it worked!
Thanks anyway.
BTW: I start the service using Passenger:
passenger start -a 127.0.0.1 -p 9051 -e production -d
We have an issue with TS min_inflex_len and delta indexes on our production servers
I have everything working in development mode on OSX but when we deploy via capistrano to our Ubuntu server running passenger / apache, both delta indexing seems to stop as well as min_inflex_len
We're deploying as ubuntu user which also runs apache. We had an issue yesterday with production folder not being created but we manually created and I can see a list of the delta files in there now.
I've followed the docs through..
I can see the delta flag set to true on record creation but when searching it doesn't find the record. Once we rebuild index (as ubuntu user) I can find record, but only with full string.
My sphinx.conf file is as follows:
production:
enable_star: 1
min_infix_len: 3
bin_path: "/usr/local/bin"
version: 2.0.5
mem_limit: 128M
searchd_log_file: "/var/log/searchd.log"
development:
min_infix_len: 3
bin_path: "/usr/local/bin"
version: 2.0.5
mem_limit: 128M
Rebuild, start and conf work fine and my production.conf file contains this:
index company_core
{
source = company_core_0
path = /var/www/html/ordering-main/releases/20110831095808/db/sphinx/production/company_core
charset_type = utf-8
min_infix_len = 1
enable_star = 1
}
I also have this in my production.rb env file:
ThinkingSphinx.deltas_enabled = true
ThinkingSphinx.updates_enabled = true
My searchd.log file only has this in:
[Wed Aug 31 09:40:04.437 2011] [ 5485] accepting connections
Nothing at all appears in apache error / access log
-- EDIT ---
define_index do
indexes :name
has created_at, updated_at
set_property :delta => true
end
Not sure if it's the cause, but the version values in your sphinx.yml are for the version of Sphinx, not Thinking Sphinx - so you may want to run indexer to double-check what that value should be (likely one of 0.9.9, 1.10-beta or 2.0.1-beta).
Also: on the server, in script/console production, can you share the full output of the following (not interested in the value returned, hence why I'm forcing it to be an empty string - it'll just get in the way otherwise):
Company.define_indexes && Company.index_delta; ''
``
delta not working on production server for passenger user, you have to give the write permission to your passenger user when creating index and write it to db/sphinx/production folder.
Or you can set two line in your nginx/conf/nginx.conf
passenger_user_switching off;
passenger_default_user root;
Example:
passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0;
passenger_ruby /usr/local/bin/ruby;
passenger_user_switching off;
passenger_default_user root;