软件:nginx

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
软件:nginx [2025/10/21 23:22] admin软件:nginx [2025/12/07 21:54] (当前版本) admin
行 31: 行 31:
 <code nginx> <code nginx>
 #卸载apache #卸载apache
-apt purge apache2 apache2-bin apache2-data apache2-utilsi+apt purge apache2 apache2-bin apache2-data apache2-utils
  
 #安装Nginx环境依赖 #安装Nginx环境依赖
行 63: 行 63:
     listen 80;     listen 80;
     server_name localhost;     server_name localhost;
 +    location = /adminer.php{
 +        root /var/www/html;
 +        try_files $uri =404;
 +        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
 +        include fastcgi_params;
 +        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 +    }
     # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.     # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
     location / {     location / {
行 73: 行 80:
 sudo vi /etc/nginx/conf.d/default.conf sudo vi /etc/nginx/conf.d/default.conf
 server { server {
-    listen  [::]:433; # IPv6 +    listen  [::]:433 ssl http2; # IPv6 
-    listen       433;+    listen       433 ssl http2;
     server_name  localhost;     server_name  localhost;
 +    
 +    #填写证书文件绝对路径
 +    ssl_certificate /etc/nginx/conf.d/cert/localhost.pem;
 +    #填写证书私钥文件绝对路径
 +    ssl_certificate_key /etc/nginx/conf.d/cert/localhost.key;
 +
     root /var/www/html;     root /var/www/html;
     location / {     location / {
行 137: 行 150:
  
 <code -> <code ->
 +apt -y install openssl 
 +
 openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
     -keyout localhost.key \     -keyout localhost.key \
行 229: 行 244:
 #填写证书私钥文件绝对路径 #填写证书私钥文件绝对路径
 ssl_certificate_key /etc/nginx/conf.d/cert/localhost.key; ssl_certificate_key /etc/nginx/conf.d/cert/localhost.key;
 +
 +#安全配置
 ssl_session_cache shared:SSL:1m; ssl_session_cache shared:SSL:1m;
 ssl_session_timeout 5m;  ssl_session_timeout 5m; 
  • 软件/nginx.1761060121.txt.gz
  • 最后更改: 2025/10/21 23:22
  • admin