AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-549310

Philipp Mochine's questions

Martin Hope
Philipp Mochine
Asked: 2020-08-18 04:07:29 +0800 CST

supervisord:你能在不同的命令路径上运行两个同名的程序吗?

  • 0

当我创建两个文件时:

地平线-staging.conf

[program:horizon]
process_name=%(program_name)s
command=php /var/www/staging/current/artisan horizon
autostart=true
autorestart=true
user=forge
redirect_stderr=true

地平线生产.conf

[program:horizon]
process_name=%(program_name)s
command=php /var/www/production/current/artisan horizon
autostart=true
autorestart=true
user=forge
redirect_stderr=true

并发射命令sudo supervisorctl start horizon。它运行这两个程序吗?(附带问题,我可以把它也放在一个 conf 文件中吗?)

supervisord
  • 1 个回答
  • 718 Views
Martin Hope
Philipp Mochine
Asked: 2019-10-08 09:58:31 +0800 CST

为 Laravel 有条件地使用 nginx 服务 WEBP

  • 1

我无法在我的 Ubuntu 服务器上向 webp 提供 jpeg 或 png 图像。

请求:

Request URL: https://staging.myserver.com/images/mainfoto.jpg 
Request Method: GET

回应是:

accept-ranges: bytes
content-length: 304152
content-type: image/jpeg
date: Mon, 07 Oct 2019 17:33:14 GMT
etag: "5d9a2b60-4a418"
last-modified: Sun, 06 Oct 2019 17:58:56 GMT
server: nginx/1.14.0 (Ubuntu)
status: 200
vary: Accept

在sudo nano /etc/nginx/nginx.conf

http {
...
include /etc/nginx/mime.types; #I checked the webp is included
...
    map $http_accept $webp_suffix {
       default "";
       "~*webp" ".webp";
    }
...
}

然后在我的sudo nano /etc/nginx/sites-available/staging.myserver.com

# Checking if there's a WebP version for the requested image ..
location ~* ^.+\.(jpe?g|png)$ {
   add_header Vary Accept;
   # and if so, serving it
   try_files $1$webp_suffix $uri =404;
}

并完成:

sudo nginx -t
sudo systemctl reload nginx

并通过硬重新加载删除了浏览器缓存

有什么想法我能做什么?


完整的服务器配置文件在这里:

server {
    server_name staging.myserver.com;
    root /var/www/myserver-staging/current/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

        auth_basic "Staff Only";
        auth_basic_user_file "/var/www/myserver/.htpasswd";
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }
    # Checking if there's a WebP version for the requested image ..
    location ~* ^.+\.(jpe?g|png)$ {
       add_header Vary Accept;
       # and if so, serving it
       try_files $1$webp_suffix $uri =404;
    }
    location ~ /\.(?!well-known).* {
        deny all;
    }
   listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/staging.myserver.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/staging.myserver.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = staging.myserver.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name staging.myserver.com;



    listen 80;
    return 404; # managed by Certbot


}
nginx
  • 1 个回答
  • 2939 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve