|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- ```
- 确定网站目录:/var/www/publishapplication/d1.xyz/html
- 树形查看: tree /var/www/publishapplication/d1.xyz/html
- 打开编辑:sudo nano /etc/nginx/sites-available/default
-
-
- server {
- listen 5008;
- server_name other;
- location / {
- alias /var/www/publishapplication/d1.xyz/html/;
- index index.html;
- try_files $uri $uri/ /index.html;
- }
- }
-
-
- 在本地和控制台都允许端口:sudo ufw allow 5008
- 确认语法:nginx -t
- 重新加载:nginx -s reload
- 确认gizp是否打开:sudo nano /etc/nginx/nginx.conf
- gzip on;
- gzip_min_length 1;
- gzip_comp_level 2;
- gzip_types text/plain applicaiton/x-javascript text/css application/xml text/javascript applicaiton/x-http-php image/jpeg image/gif image/png;
- ```
-
-
-
- 开放目录和文件
-
- ```
- sudo nano /etc/nginx/sites-available/default
-
-
- server {
- listen 5008;
- server_name other;
- location / {
- alias /var/www/publishapplication/d1.xyz/html/;
- autoindex on;
- index index.html;
- try_files $uri $uri/ /index.html;
- }
- }
-
- ```
-
-
-
- 当有并发产生,让`Nginx`控制响应频率。
-
- ```
- sudo nano /etc/nginx/sites-available/default
-
-
- server {
- listen 5008;
- server_name other;
- location / {
- alias /var/www/publishapplication/d1.xyz/html/;
- autoindex on;
- index index.html;
- set $limit_rate 1k;
- try_files $uri $uri/ /index.html;
- }
-
- }
-
- ```
-
-
-
- 记录日志
-
- ```
- 查看配置:sudo nano /etc/nginx/nginx.conf
- 确认日志文件:
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
-
- log format main '$remote_addr' --不同域名可以不同日志记录
- access_log /var/log/nginx/access.log main;
- ```
-
|