我只是将另一个 ebs 卷附加到正在运行的实例上。但是如何访问该卷?我在/dev/sda任何地方都找不到目录。我应该在哪里看?
我正在尝试yum updateEC2 服务器,但失败了。这是第一次发生,我需要做些什么来解决这个问题?
--> Running transaction check
---> Package libXcomposite.x86_64 0:0.4.3-4.6.amzn1 will be installed
---> Package nginx.x86_64 1:1.10.1-1.el7.ngx will be an update
--> Processing Dependency: systemd for package: 1:nginx-1.10.1-1.el7.ngx.x86_64
--> Processing Dependency: libpcre.so.1()(64bit) for package: 1:nginx-1.10.1-1.el7.ngx.x86_64
---> Package python27-futures.noarch 0:3.0.3-1.3.amzn1 will be installed
--> Finished Dependency Resolution
--> Running transaction check
---> Package kernel.x86_64 0:4.1.13-19.30.amzn1 will be erased
---> Package nginx.x86_64 1:1.10.1-1.el7.ngx will be an update
--> Processing Dependency: systemd for package: 1:nginx-1.10.1-1.el7.ngx.x86_64
--> Processing Dependency: libpcre.so.1()(64bit) for …Run Code Online (Sandbox Code Playgroud) 我有多个 url 需要使用 nginx 添加相同的标头集。这是文件名。
File Group1
https://www.example.com/news/2017-08-03/article-xyz/
https://www.example.com/news/2017-08-03/article-xyz/topics/
https://www.example.com/news/2017-08-03/article-xyz/gallery/
File Group2
https://www.example.com/news/2017-08-02/article-abc/
https://www.example.com/news/2017-08-02/article-abc/topics/
https://www.example.com/news/2017-08-02/article-abc/gallery/
Run Code Online (Sandbox Code Playgroud)
因此在这种情况下 File Group1 需要:
add_header Cache-Tag article-xyz;
Run Code Online (Sandbox Code Playgroud)
文件组2需要:
add_header Cache-Tag article-abc;
Run Code Online (Sandbox Code Playgroud)
所以 nginx.conf 应该是这样的
location /news/ {
add_header Cache-Tag article-abc;
}
Run Code Online (Sandbox Code Playgroud)
但是我如何在添加标头中动态应用它呢?
我在使用 expires 标头时遇到问题。当我设置过期并通过浏览器访问文件时,它变成了 Not Found 404。
这是我在 nginx.conf 上的虚拟服务器设置
server {
listen 80;
server_name blgourl.com www.blogourl.com
location / {
root /data/file/static/blogourl;
index index.html index.htm index.php;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
location ~* \.php$ {
ssi on;
root /data/file/static;
fastcgi_param HTTP_USER_AGENT $http_user_agent;
fastcgi_index index.php;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_pass unix:/var/run/php-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /data/file/static/blogourl$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
Run Code Online (Sandbox Code Playgroud) 我在 Amazon AWS 上,并且我的帐户中有两个 EC2 实例。尝试使用内部私有 IP 通过 SSH 将 rsa 密钥发送到另一个 EC2 实例。但它不起作用。
scp -i .ssh/id_rsa.pub xxx.xxx.xxx.xxx:/root/.ssh/authorized_keys2
Run Code Online (Sandbox Code Playgroud)
我在做什么错以及如何使用 ssh 将文件发送到另一个 EC2 帐户。
我不小心gzip -rv directory,现在所有单个文件都是 .gz 格式。如何撤消此操作并将 .gz 文件中的所有 .gz 文件压缩directory?
我如何只对整个目录进行 gzip 压缩?
我尝试过,gunzip directory/*.gz但只对目录中的文件进行了压缩/它不会对“目录”以外的目录进行压缩。
您好,我正在使用 Amazon Ec2 和 Nginx。我最近设置了 nginx,例如,当我访问 blog.com/index.php 时,它会正确显示在浏览器中,但是当我访问其他文件扩展名(如 JPEG、PNG、JS 等)时,文件变为 403。
这是错误日志。
[error] 5637#0: *132 open() "/var/www/html/js/jquery.js" failed (13: Permission denied), client: 10.000.00.00, server: blog.com, request: "GET /js/jquery.min.js HTTP/1.1", host: "blog.com"
Run Code Online (Sandbox Code Playgroud)
js 文件的权限统计(403 Forbiddon)
-rw-r--r-- 1 ec2-user ec2-user 93636 /var/www/html/js/jquery.js
Run Code Online (Sandbox Code Playgroud)
index.php 文件的权限统计
-rw-r--r-- 1 ec2-user ec2-user 1281 /var/www/html/index.php
Run Code Online (Sandbox Code Playgroud)
我的 Nginx 配置文件:
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 8096;
multi_accept on;
use epoll;
}
http {
charset UTF-8;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - …Run Code Online (Sandbox Code Playgroud) 我不小心更改了权限chmod -R 777 /var,现在我无法访问 EC2 实例,我该如何解决这个问题?
我为 crontab 输入了一个命令,但似乎什么也没发生。
#vi /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# …Run Code Online (Sandbox Code Playgroud) amazon-ec2 ×6
nginx ×4
linux ×2
amazon-ami ×1
amazon-ebs ×1
cron ×1
fedora ×1
gzip ×1
permissions ×1
scp ×1
ssh ×1