|
|
@ -4,6 +4,7 @@ use symbols::acme::{AcmeCert, AcmeCertChain}; |
|
|
|
use symbols::file::File;
|
|
|
|
use symbols::hook::Hook;
|
|
|
|
use symbols::list::ListAction;
|
|
|
|
use symbols::nginx::server::NginxServer;
|
|
|
|
use symbols::systemd::reload::ReloadService;
|
|
|
|
use symbols::tls::SelfSignedTlsCert;
|
|
|
|
|
|
|
@ -52,4 +53,37 @@ impl<'b, C: 'b + CommandRunner, R: 'b + SymbolRunner> SymbolFactory<'b, C, R> { |
|
|
|
}"
|
|
|
|
)).into_action(self.symbol_runner)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_php_fpm_pool_socket_path<'a>(&'a self, user_name: &'static str) -> String {
|
|
|
|
format!("/run/php/{}.sock", user_name)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_php_fpm_pool<'a>(&'a self, user_name: &'static str) -> Box<Action + 'a> {
|
|
|
|
let socket = self.get_php_fpm_pool_socket_path(user_name);
|
|
|
|
Box::new(Hook::new(
|
|
|
|
File::new(
|
|
|
|
format!("/etc/php/7.0/fpm/pool.d/{}.conf", user_name),
|
|
|
|
format!(
|
|
|
|
"[{0}]
|
|
|
|
|
|
|
|
user = {0}
|
|
|
|
group = www-data
|
|
|
|
listen = {1}
|
|
|
|
listen.owner = www-data
|
|
|
|
pm = ondemand
|
|
|
|
pm.max_children = 10"
|
|
|
|
, user_name, socket)),
|
|
|
|
ReloadService::new("php7.0-fpm", self.command_runner)
|
|
|
|
)).into_action(self.symbol_runner)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_nginx_php_server<'a>(&'a self, host_name: &'static str, user_name: &'static str, root_dir: &'static str) -> NginxServer<'a, C, String> {
|
|
|
|
let socket = self.get_php_fpm_pool_socket_path(user_name);
|
|
|
|
NginxServer::new_php(
|
|
|
|
host_name,
|
|
|
|
socket.into(),
|
|
|
|
root_dir,
|
|
|
|
self.command_runner
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|