(website *model.Website, runtime *model.Runtime)
| 207 | } |
| 208 | |
| 209 | func createWebsiteFolder(website *model.Website, runtime *model.Runtime) error { |
| 210 | siteFolder := GetSiteDir(website.Alias) |
| 211 | fileOp := files.NewFileOp() |
| 212 | if !fileOp.Stat(siteFolder) { |
| 213 | if err := fileOp.CreateDir(siteFolder, constant.DirPerm); err != nil { |
| 214 | return err |
| 215 | } |
| 216 | if err := fileOp.CreateDir(path.Join(siteFolder, "log"), constant.DirPerm); err != nil { |
| 217 | return err |
| 218 | } |
| 219 | if err := fileOp.CreateFile(path.Join(siteFolder, "log", "access.log")); err != nil { |
| 220 | return err |
| 221 | } |
| 222 | if err := fileOp.CreateFile(path.Join(siteFolder, "log", "error.log")); err != nil { |
| 223 | return err |
| 224 | } |
| 225 | if website.Type != constant.Stream { |
| 226 | if err := fileOp.CreateDir(path.Join(siteFolder, "index"), constant.DirPerm); err != nil { |
| 227 | return err |
| 228 | } |
| 229 | if err := fileOp.CreateDir(path.Join(siteFolder, "ssl"), constant.DirPerm); err != nil { |
| 230 | return err |
| 231 | } |
| 232 | } |
| 233 | if website.Type == constant.Runtime { |
| 234 | if runtime.Type == constant.RuntimePHP && runtime.Resource == constant.ResourceLocal { |
| 235 | phpPoolDir := path.Join(siteFolder, "php-pool") |
| 236 | if err := fileOp.CreateDir(phpPoolDir, constant.DirPerm); err != nil { |
| 237 | return err |
| 238 | } |
| 239 | if err := fileOp.CreateFile(path.Join(phpPoolDir, "php-fpm.sock")); err != nil { |
| 240 | return err |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | if website.Type == constant.Static || (website.Type == constant.Runtime && runtime.Type == constant.RuntimePHP) { |
| 245 | if err := createIndexFile(website, runtime); err != nil { |
| 246 | return err |
| 247 | } |
| 248 | } |
| 249 | if website.Type == constant.Proxy { |
| 250 | if err := createProxyFile(website); err != nil { |
| 251 | return err |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | return nil |
| 256 | } |
| 257 | |
| 258 | func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, appInstall *model.AppInstall, runtime *model.Runtime, streamConfig request.StreamConfig) error { |
| 259 | nginxInstall, err := getAppInstallByKey(constant.AppOpenresty) |
no test coverage detected