mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Grueing around
This commit is contained in:
@@ -32,8 +32,8 @@ function __construct(CommandLine $cli, Filesystem $files, Configuration $configu
|
|||||||
function install()
|
function install()
|
||||||
{
|
{
|
||||||
$this->installCaddyFile();
|
$this->installCaddyFile();
|
||||||
$this->installCaddyDirectory();
|
// $this->installCaddyDirectory();
|
||||||
$this->installCaddyDaemon();
|
// $this->installCaddyDaemon();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,8 +46,8 @@ function install()
|
|||||||
function installCaddyFile()
|
function installCaddyFile()
|
||||||
{
|
{
|
||||||
$this->files->putAsUser(
|
$this->files->putAsUser(
|
||||||
VALET_HOME_PATH.'/Caddyfile',
|
'/usr/local/etc/nginx/servers/valet.conf',
|
||||||
str_replace(['VALET_HOME_PATH', 'VALET_SERVER_PATH'], [VALET_HOME_PATH, VALET_SERVER_PATH], $this->files->get(__DIR__.'/../stubs/Caddyfile'))
|
str_replace(['VALET_HOME_PATH', 'VALET_SERVER_PATH'], [VALET_HOME_PATH, VALET_SERVER_PATH], $this->files->get(__DIR__.'/../stubs/valet.conf'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,16 +58,16 @@ function installCaddyFile()
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function installCaddyDirectory()
|
// function installCaddyDirectory()
|
||||||
{
|
// {
|
||||||
if (! $this->files->isDir($caddyDirectory = VALET_HOME_PATH.'/Caddy')) {
|
// if (! $this->files->isDir($caddyDirectory = VALET_HOME_PATH.'/Caddy')) {
|
||||||
$this->files->mkdirAsUser($caddyDirectory);
|
// $this->files->mkdirAsUser($caddyDirectory);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->files->putAsUser($caddyDirectory.'/.keep', "\n");
|
// $this->files->putAsUser($caddyDirectory.'/.keep', "\n");
|
||||||
|
|
||||||
$this->rewriteSecureCaddyFiles();
|
// $this->rewriteSecureCaddyFiles();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate fresh Caddyfiles for existing secure sites.
|
* Generate fresh Caddyfiles for existing secure sites.
|
||||||
@@ -76,29 +76,29 @@ function installCaddyDirectory()
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function rewriteSecureCaddyFiles()
|
// function rewriteSecureCaddyFiles()
|
||||||
{
|
// {
|
||||||
$domain = $this->configuration->read()['domain'];
|
// $domain = $this->configuration->read()['domain'];
|
||||||
|
|
||||||
$this->site->resecureForNewDomain($domain, $domain);
|
// $this->site->resecureForNewDomain($domain, $domain);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the Caddy daemon on a system level daemon.
|
* Install the Caddy daemon on a system level daemon.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function installCaddyDaemon()
|
// function installCaddyDaemon()
|
||||||
{
|
// {
|
||||||
$contents = str_replace(
|
// $contents = str_replace(
|
||||||
'VALET_PATH', $this->files->realpath(__DIR__.'/../../'),
|
// 'VALET_PATH', $this->files->realpath(__DIR__.'/../../'),
|
||||||
$this->files->get(__DIR__.'/../stubs/daemon.plist')
|
// $this->files->get(__DIR__.'/../stubs/daemon.plist')
|
||||||
);
|
// );
|
||||||
|
|
||||||
$this->files->put(
|
// $this->files->put(
|
||||||
$this->daemonPath, str_replace('VALET_HOME_PATH', VALET_HOME_PATH, $contents)
|
// $this->daemonPath, str_replace('VALET_HOME_PATH', VALET_HOME_PATH, $contents)
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart the launch daemon.
|
* Restart the launch daemon.
|
||||||
@@ -107,9 +107,7 @@ function installCaddyDaemon()
|
|||||||
*/
|
*/
|
||||||
function restart()
|
function restart()
|
||||||
{
|
{
|
||||||
$this->cli->quietly('sudo launchctl unload '.$this->daemonPath);
|
$this->cli->quietly('sudo brew services restart nginx');
|
||||||
$this->files->unlink(VALET_HOME_PATH.'/Caddy/.DS_Store');
|
|
||||||
$this->cli->quietly('sudo launchctl load '.$this->daemonPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,7 +117,7 @@ function restart()
|
|||||||
*/
|
*/
|
||||||
function stop()
|
function stop()
|
||||||
{
|
{
|
||||||
$this->cli->quietly('sudo launchctl unload '.$this->daemonPath);
|
$this->cli->quietly('sudo brew services stop nginx');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,6 +129,6 @@ function uninstall()
|
|||||||
{
|
{
|
||||||
$this->stop();
|
$this->stop();
|
||||||
|
|
||||||
$this->files->unlink($this->daemonPath);
|
// $this->files->unlink($this->daemonPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,15 +83,14 @@ function createExtensionsDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the directory for Caddy log.
|
* Create the directory for Nginx logs.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function createLogDirectory()
|
function createLogDirectory()
|
||||||
{
|
{
|
||||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Log', user());
|
$this->files->ensureDirExists(VALET_HOME_PATH.'/Log', user());
|
||||||
$this->files->touch(VALET_HOME_PATH.'/Log/access.log');
|
$this->files->touch(VALET_HOME_PATH.'/Log/nginx-error.log');
|
||||||
$this->files->touch(VALET_HOME_PATH.'/Log/error.log');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function updateConfiguration()
|
|||||||
|
|
||||||
$contents = preg_replace('/^user = .+$/m', 'user = '.user(), $contents);
|
$contents = preg_replace('/^user = .+$/m', 'user = '.user(), $contents);
|
||||||
$contents = preg_replace('/^group = .+$/m', 'group = staff', $contents);
|
$contents = preg_replace('/^group = .+$/m', 'group = staff', $contents);
|
||||||
$contents = preg_replace('/^listen = .+$/m', 'listen = 127.0.0.1:9000', $contents);
|
$contents = preg_replace('/^listen = .+$/m', 'listen = /var/run/fpm-valet.sock', $contents);
|
||||||
|
|
||||||
$this->files->put($this->fpmConfigPath(), $contents);
|
$this->files->put($this->fpmConfigPath(), $contents);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,21 +10,21 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /Users/adamwathan/.composer/vendor/laravel/valet/server.php?$query_string last;
|
rewrite ^ VALET_SERVER_PATH?$query_string last;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /favicon.ico { access_log off; log_not_found off; }
|
location = /favicon.ico { access_log off; log_not_found off; }
|
||||||
location = /robots.txt { access_log off; log_not_found off; }
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
access_log off;
|
access_log off;
|
||||||
error_log /Users/adamwathan/nginx-error.log;
|
error_log VALET_HOME_PATH/Log/nginx-error.log;
|
||||||
|
|
||||||
error_page 404 /Users/adamwathan/.composer/vendor/laravel/valet/server.php;
|
error_page 404 VALET_SERVER_PATH;
|
||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass unix:/var/run/valet/fpm.sock;
|
fastcgi_pass unix:/var/run/fpm-valet.sock;
|
||||||
fastcgi_index Users/adamwathan/.composer/vendor/laravel/valet/server.php;
|
fastcgi_index VALET_SERVER_PATH;
|
||||||
|
|
||||||
fastcgi_param QUERY_STRING $query_string;
|
fastcgi_param QUERY_STRING $query_string;
|
||||||
fastcgi_param REQUEST_METHOD $request_method;
|
fastcgi_param REQUEST_METHOD $request_method;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public function test_fpm_is_configured_with_the_correct_user_group_and_port()
|
|||||||
$contents = file_get_contents(__DIR__.'/output/fpm.conf');
|
$contents = file_get_contents(__DIR__.'/output/fpm.conf');
|
||||||
$this->assertTrue(strpos($contents, sprintf("\nuser = %s", user())) !== false);
|
$this->assertTrue(strpos($contents, sprintf("\nuser = %s", user())) !== false);
|
||||||
$this->assertTrue(strpos($contents, "\ngroup = staff") !== false);
|
$this->assertTrue(strpos($contents, "\ngroup = staff") !== false);
|
||||||
$this->assertTrue(strpos($contents, "\nlisten = 127.0.0.1:9000") !== false);
|
$this->assertTrue(strpos($contents, "\nlisten = /var/run/fpm-valet.sock") !== false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user