Redmine + Apache + Passenger + Fedora27 Installation

Added by Franck Bailliet 6 months ago

Greats everybody,

I first installed redmine on localhost webrick server and it worked.
But i want my own public server on production on the address www.redmine.infosysdevconcept.net.
I first followed instructions of this tutorial :
http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine
And second passenger sounded me a fine solution to can run the server (i did not understand why there were ne instruction like
ruby /bin/rails server webrick -e production)
I found a nice tutorial for this
http://www.redmine.org/projects/redmine/wiki/Redmine+Apache+Passenger_InstallOnRedHat
I just arranged the instructions for a VirtualHost instead of a sub-URI
And so i have a result !
First SELinux asked me autorizations for passenger when i restarted apache,
And finally the web server display the content of /public/dispatch.fcgi
I guess something is wrong with this file or with environment.rb...
Everybody can visit the site and read my configuration of dispatch.fcgi
I corrected the path for dispatcher.rb, but it's not sufficient !

Any help ar advice welcome,
Regards,

Francesco1975

Replies (2)

RE: Redmine + Apache + Passenger + Fedora27 Installation - Added by Immanuel Wilhelmy 6 months ago

Good morning,

without adressing the root cause I observe that the tutorials you are using are ages old. Go to http://www.redmine.org/projects/redmine/wiki/HowTos and pick the newest one possibly applying for your configuration. Be aware that the installation howto for the OS nearly always includes configuration of apache/passenger or whatever.

Good luck and hope that helps a little bit.

RE: Redmine + Apache + Passenger + Fedora27 Installation - Added by Martin Denizet (redmine.org team member) 6 months ago

Hello,

Franck Bailliet wrote:

And second passenger sounded me a fine solution to can run the server

Installing 2 passengers for a single Redmine/RailsApp instance is very likely a terrible idea that will lead to corruptions!

Franck Bailliet wrote:

(i did not understand why there were ne instruction like
ruby /bin/rails server webrick -e production)

It's quite useful to test that the production instance is ready (no gem/config issues) but you're right, that's not meant to be used for actual production

Franck Bailliet wrote:

First SELinux asked me autorizations for passenger when i restarted apache,
And finally the web server display the content of /public/dispatch.fcgi
I guess something is wrong with this file or with environment.rb...
Everybody can visit the site and read my configuration of dispatch.fcgi
I corrected the path for dispatcher.rb, but it's not sufficient !

I think there is a misconception here. Unlike php, in RailsApps we do not open files. The app is loaded in memory and queried by web transport.
Here is a simplified Apache (compatible >=2.4) file I use with passenger and Redmine on Ubuntu:

ServerName redmine.domain.com

<VirtualHost *:443>
 ServerAdmin admin@domain.com
 ServerName redmine.domain.com

 # Enable SSL with Perfect Forward Secrecy
 SSLEngine on
 SSLCertificateFile /etc/apache2/ssl/redmine.crt
 SSLCertificateKeyFile /etc/apache2/ssl/redmine.key

 DocumentRoot /opt/redmine/current/public/

 ## Passenger Configuration
 ## Details at http://www.modrails.com/documentation/Users%20guide%20Apache.html

 PassengerMinInstances 6
 PassengerMaxPoolSize 20
 RailsBaseURI /
 PassengerAppRoot /opt/redmine/current

 # Speeds up spawn time tremendously -- if your app is compatible. 
 # RMagick seems to be incompatible with smart spawning
 RailsSpawnMethod smart

 # Keep the application instances alive longer. Default is 300 (seconds)
 PassengerPoolIdleTime 1000

 # Keep the spawners alive, which speeds up spawning a new Application
 # listener after a period of inactivity at the expense of memory.
 RailsAppSpawnerIdleTime 3600

 # Additionally keep a copy of the Rails framework in memory. If you're 
 # using multiple apps on the same version of Rails, this will speed up
 # the creation of new RailsAppSpawners. This isn't necessary if you're
 # only running one or 2 applications, or if your applications use
 # different versions of Rails.
 PassengerMaxPreloaderIdleTime 0

 # Just in case you're leaking memory, restart a listener 
 # after processing 5000 requests
 PassengerMaxRequests 5000

 # only check for restart.txt et al up to once every 5 seconds, 
 # instead of once per processed request
 PassengerStatThrottleRate 5

 # If user switching support is enabled, then Phusion Passenger will by default run the web application as the owner if the file config/environment.rb (for Rails apps) or config.ru (for Rack apps). This option allows you to override that behavior and explicitly set a user to run the web application as, regardless of the ownership of environment.rb/config.ru.
 PassengerUser www-data
 PassengerGroup www-data

 # By default, Phusion Passenger does not start any application instances until said web application is first accessed. The result is that the first visitor of said web application might experience a small delay as Phusion Passenger is starting the web application on demand. If that is undesirable, then this directive can be used to pre-started application instances during Apache startup.
 PassengerPreStart https://localhost

 <Directory /opt/redmine/current/public/>
 Options +Indexes +FollowSymLinks -MultiViews
 AllowOverride All
 <IfVersion < 2.3 >
     Order allow,deny
     Allow from all
 </IfVersion>
 <IfVersion >= 2.3>
     Require all granted
 </IfVersion>
 </Directory>

 AddOutputFilter DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

 ErrorLog ${APACHE_LOG_DIR}/redmine.error.log
 LogLevel warn
 CustomLog ${APACHE_LOG_DIR}/redmine.access.log combined
 ServerSignature Off
 
</VirtualHost>

Note that passenger is not loaded in this file. You loaded it separately if you followed install instructions.
www-data is the web user on Debian/Ubuntu, you have to replace it with apache

Hope it helps.
Cheers,

(1-2/2)