首页 > 系统相关 >linux回炉第二十八天

linux回炉第二十八天

时间:2023-01-21 11:00:15浏览次数:43  
标签:index www 第二十八 name server 回炉 linux org data

cat /etc/mime.types
请求报文:
方法:URL:版本
首部字段:值


curl -v www.jd.com

响应报文:
版本:状态码:短语
首部字段:值

curl -H "name: wang" www.dayu.com -v
1xx: 
2xx:
3xx:
4xx:
5xx:
cat /proc/sys/fs/file-max
nginx -V
nginx -t
nginx -s reload
nginx -s stop


systemctl start nginx
systemctl stop nginx
workr_processes auto;
#worker_cpu_affinity auto;
worker_cpu_affinity 0001 0010;

worker_rlimit_nofile 65536; 配合etc/security/limit.conf 里的nofile使用

daemon off; #dockerfile必须关闭后台执行
全局main
event {

}

http {

}

mail{



stream {

}
server_tokens off;
server {
listen 80;
server_name www.wang.org;
root /data/nginx/html;
location / {
index index.html;
}

}
server {
listen 80;
server_name www.wang.org;
root /data/www;
location {
index index.html;
}
location /test {
alias /mnt/test;
}
error_page 404 @@error_404;
location @@error_404 {
default_type text/html;
charset utf8;
return 200 '您访问的页面走丢了!';
}
deny 11.0.1.1;
allow 11.0.1.0/24;
deny all;
}
server {
listen 80;
server_name www.wang.org;
root /data/www;
location / {
index index.html;
}
location /admin {
auth_basic "please input your user and passwd";
auth_basic_user_file /opt/user.txt;
}
}


htpasswd -c -b /opt/user.txt wang 123456
htpasswd -b /opt/user.txt li 123456
server {
listen 80;
server_name www.wang.org;
root /data/www;
error_page 404 /data/www/error/404.html;
location / {
index index.html;
}
}

server {
listen 80;
server_name www.li.org;
root /data/www;
error_page 404 =200 /index.html;
location / {
index index.html;
}
}

server {
listen 80;
server_name www.wang.com;
error_log /data/www/wang.com-error.log;
try_files $uri $uri/index.html $url.html =489;
root /data/www;
location / {
index index.html;
}
}
autoindex on;
autoindex_format html;
autoindex_format json;
limit_rate 100k;
limit_rate 100m;
core
access
auth_basic
sub_status
gzip
ssl
rewrite
proxy
stream
upstream
fastcgi
referer
log
mail
limit_req_zone $binary_remote_addr zone=test:10m rate=1r/s;

server {
......
limit_req zone=test burst=10 nodelay;
......
}
limit_conn_zone $binary_remote_addr zone=conn_zone:10m;
server {
......
limit_conn conn_zone=2;
......
}
server {
listen 80;
server_name www.wang.org;
root /data/www;
location /status {
stub_status;
}
}
curl -s http://www.wang.org/status | awk 'NR==3{print $3}'
server {
......
gzip on;
gzip_comp_level 5;
gzip_min_length 1k;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/gif image/png;
gzip_vary on;
......

}
server {
listen 443 ssl http2;
server_name www.wang.org;
root /data/www;

ssl_certificate /etc/nginx/cert/www.wang.org.crt;
ssl_certificate_key /etc/nginx/cert/www.wang.org.key;
location / {
index index.html;
}
}
apt install libnginx-mod-http-echo
server {
listen 8080;
server_name www.li.org;
root /data/www;
location /hahaha {
index index.html;
default_type text/html;
root /mnt/test;
if (!-e $request_filename) {
echo "$request_filename is not exist";
}

}

}
server {
listen 8080;
server_name www.li.org;
root /data/www;
location /test {
if ($scheme = http){
return 301 http://www.wang.org;
}
}

}
server {
listen 80;
server_name www.wang.org;
root /data/www;
location / {
return https://www.wang.org;
}
}

server {
listen 443 ssl http2;
server_name www.wang.org;
ssl_certificate /etc/nginx/cert/www.wang.org.crt;
ssl_certificate_key /etc/nginx/cert/www.wang.org.key;
root /data/www;
location / {
index index.html;
}
}
server {
listen 8080;
server_name www.li.org;
root /data/www;
location /test {
if ($scheme = http){
return 301 https://www.li.org;
}
}

}
server {
listen 8080;
server_name www.li.org;
root /data/www;
return 302 https://$server_name$request_uri;
}
}

server {
listen 80;
server_name www.wang.org;
root /data/www;
location / {
rewrite /index.html http://www.baidu.com redirect;
}
}
server {
listen 8080;
server_name www.li.org;
root /data/www;
location / {
rewrite /index.html http://www.baidu.com permanent;
}
}

server {
listen 80;
server_name www.wang.org;
root /data/www;
location / {
rewrite /index.html http://www.baidu.com redirect;
}
}
server {
listen 80;
server_name www.wang.org;
root /data/www;
location / {
rewrite .* /index.html redirect;
}
}

server {
listen 8080;
server_name www.li.org;
root /data/www;
location / {
rewrite .* http://www.wang.org/index.html permanent;
}
}
vim /etc/nginx/nginx.conf
http {
......
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent" "$http_x_forwarded_for"';

......
}




server {
listen 8080;
server_name www.li.org;
root /data/www;
access_log /data/www/li.org_access.log main;
location / {
index index.html;
}
}
# 防盗链
server {
listen 8080;
server_name www.li.org;
root /data/www;
access_log /data/www/li.org_access.log main;

location /images {
index index.html;
valid_referers none blocked server_names
m.li.org ~\.google\. ~\.baidu\.;
if ($invalid_referer){
return 403;
}
}
}
server {
listen 80;
server_name www.eryou.org;
root /data/www;
location / {
# proxy_pass http://11.0.1.58;
proxy_pass http://www.test.org;
proxy_set_header Host $http_host;
}

}
server {
listen 80;
server_name www.eryou.org;
root /data/www;
location ~* \.php$ {
proxy_pass http://www.test.org;
proxy_set_header Host $http_host;
}

}
proxy_cache_path
server {
listen 8888;
server_name www.li.org;
root /data/www;
access_log /data/www/li.org_access.log main;

location / {
proxy_pass http://11.0.1.58;
proxy_set_header Host $http_host;
add_header X-Via $server_addr;
add_header X-Cache $upstream_cache_status;
add_header X-Accel $server_name;
}
}
upstream webservers{
server 10.0.0.18;
server 10.0.0.28;
}

server {
listen 80;
server_name www.wang.org;
location / {
proxy_pass http://webservers;
}
}
upstream webservers{
server 10.0.0.18 weight=3;
server 10.0.0.28 weight=1;
}
upstream webservers{
server 10.0.0.18 weight 3;
server 10.0.0.28 weight 1;
server 127.0.0.1 backup;
}
upstream webservers{
ip_hash;
server 10.0.0.18 ;
server 10.0.0.28 ;
}
upstream webservers{
least_conn;
server 10.0.0.18 ;
server 10.0.0.28 ;
}
upstream webservers{
hash $remote_addr;
#hash $request_uri;
server 10.0.0.18 ;
server 10.0.0.28 ;
}
upstream webservers{
hash $remote_addr consistent;
server 10.0.0.18 ;
server 10.0.0.28 ;
}
upstream webservers{
hash $cookie_xxx;
server 10.0.0.18 ;
server 10.0.0.28 ;
}
stream {
upstream mysql {
server 11.0.1.48:3306;
server 11.0.1.58:3306;
}
upstream redis {
server 11.0.1.48:6379;
server 11.0.1.58:6379;
}
}
server {
listen 3306;
proxy_pass mysql;
}
server {
listen 6379;
proxy_pass redis;
}
server {
listen 80;
server_name www.wang.org;
root /data/www;
location ~ \.php$|ping|php-status {
root /data/php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgu_param HTTPS on;
include fastcgi_params;
}
}

标签:index,www,第二十八,name,server,回炉,linux,org,data
From: https://blog.51cto.com/dayu/6021093

相关文章

  • Linux系统入门-重定向与环境变量
    重定向一般有箭头的命令,都带有重定向的意义manbash>readme123.txtwc-l<readme123.txt管道命令符命令A| 命令BLINUX系统环境变量$PATH1、PATH:指定命令的搜索路径2、......
  • Linux Git安装&配置
    安装Git首先在Linux上安装Gitsudoapt-getinstallgit#Ubuntu/Debiansudoyuminstallgit#Centos/RedHat验证安装git--version配置Git增加用户(Github/Gite......
  • 安装 python in Linux: Ubuntu at WSL on windows
      安装ubuntu20.04appstore安装ubuntu安装异常:https://thegeekpage.com/wslregisterdistribution-failed-with-error-0x8007019e/    安装python3.8.1......
  • Linux中安装MySQL
    1.卸载系统自带的mariadb我这里使用的是Centos7,所以系统会自带Mariadb,需要先卸载掉,当然后面在安装mysql的过程中也会有提示查询已安装的Mariadb安装包:rpm-qa|......
  • Linux防火墙的使用
    防火墙放行端口kali中需要进行安装(Centos7及之后的版本是自带的,无需安装):sudoaptinstallfirewalld#查看防火墙服务的状态┌──(root㉿kali)-[/home/junlin]└─#......
  • 一些看起来很酷的Linux命令
    1.sl命令你会看到一辆火车从屏幕右边开往左边……安装$ sudo apt-get install sl运行$ sl命令有-alFe几个选项,-a An accident seems to happen. You'll ......
  • linux-安装软件
       ......
  • Linux-各类快捷键操作
            ......
  • Nginx配置将二级域名解析到Linux服务器指定端口
    最近几天用Python写了个接口后台服务,把它部在了服务器的300端口上。之后,我又要把一个二级域名解析到该服务器的300端口上,此时就要用到NGINX了。因为之前对NGINX的使用并不......
  • arch linux pacman 启动失败`GLIBC_2.34' not found
    pacman报错:pacman:/usr/lib/libc.so.6:version`GLIBC_2.34'notfound(requiredbypacman)解决方法:1下载二进制包:去https://aur.archlinux.org/packages/pacma......