Nginx服务器上的安装项目Wordpress出现301/302问题

时间:2020-07-13 16:52:12

标签: wordpress nginx-config

我在Nginx服务器上用域 http://acerampaia.local
配置了一个Wordpress项目 转到 http://acerampaia.local/wp-admin 时,它将始终重定向到 http://acerampaia.local 并响应错误代码301 :( 以下是... / site-availables / acerampaia.conf的内容:

server {
  listen 80;
  root /var/www/html/wp/acerampaia;
  server_name acerampaia.local;
  access_log /var/log/nginx/acerampaia_access.log;
  error_log /var/log/nginx/acerampaia_error.log;

  location / {
    index                               index.php index.html;
    try_files                           $uri $uri/ /index.php?$args;
  }

  # Specify a charset
    charset                         utf-8;
  # GZIP
    gzip                            off;

  # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

  # Prevents hidden files (beginning with a period) from being served
  location ~ /\. {
        access_log                      off;
        log_not_found                   off;
        deny                            all;
  }

  ###########
  # SEND EXPIRES HEADERS AND TURN OFF 404 LOGGING
  ###########

  location ~* ^.+.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log                      off;
    log_not_found                   off;
    expires                         max;
  }

  # Pass all .php files onto a php-fpm or php-cgi server
  location ~ \.php$ {
        try_files                       $uri =404;
        include                         /etc/nginx/fastcgi_params;
        fastcgi_read_timeout            3600s;
        fastcgi_buffer_size             128k;
        fastcgi_buffers                 4 128k;
        fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass                    unix:/run/php/php7.2-fpm.sock;
        #fastcgi_pass                   unix:/run/php/php7.0-fpm.sock;
        fastcgi_index                   index.php;
  }

  # ROBOTS

  location = /robots.txt {
       allow all;
       log_not_found off;
       access_log off;
  }

  # RESTRICTIONS
  location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
  }
}

请帮助我,谢谢收看。

0 个答案:

没有答案
相关问题