时间:2023-02-03 20:56:01 | 来源:建站知识
时间:2023-02-03 20:56:01 来源:建站知识
今天问同事才知道什么叫软连接补充下域名配置内容 简单弄下 需要什么在多多指教下#user nobody;worker_processes 1;pid logs/nginx.pid;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; error_log /var/log/nginx/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; # http_proxy 设置 client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 75; proxy_send_timeout 75; proxy_read_timeout 75; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_temp_path /usr/local/nginx/proxy_temp 1 2; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; #include /usr/local/nginx/conf.d/*.conf; include /usr/local/nginx/conf/sites-enabled/*.com;}
server { listen 80; root "/var/www/boinc_web/build"; 前后端分离 指向前端 index index.php index.html index.htm index.nginx-debian.html; server_name www.boinc.com; location ~ .*/.(gif|jpg|jpeg|png)$ { expires 24h; root /home/images/;#指定图片存放路径 access_log /home/softs/nginx/logs/images.log;#日志存放路径 proxy_store on; proxy_temp_path /home/images/;#图片访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } location / { try_files $uri $uri/ =404; } error_page 404 var/www/index.html; location ~ /.php$ { root /var/www/boinc/public; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www//boinc/public/$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /home/images/1.jpg; } access_log /var/log/nginx/boinc.access.log; error_log /var/log/nginx/boinc.error.log;}
这个不是前后端分离的网站nginx配置server { listen 80; root "/var/www/aicexc.12306c.com"; index index.php index.html index.htm index.nginx-debian.html; server_name www.aicexc.com; location ~ .*/.(gif|jpg|jpeg|png)$ { expires 24h; root /home/images/;#指定图片存放路径 access_log /home/softs/nginx/logs/images.log;#日志存放路径 proxy_store on; proxy_temp_path /home/images/;#图片访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } location / { try_files $uri $uri/ =404; } error_page 404 var/www/index.html; location ~ /.php$ { root /var/www/aicexc.12306c.com; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/aicexc.12306c.com/$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /home/images/1.jpg; } access_log /var/log/nginx/aicexc.access.log; error_log /var/log/nginx/aicexc.error.log;}
验证nginx配置文件是否正确 进入nginx安装目录sbin下,输入命令./nginx -t关键词:配置,访问,设置,连接