codeigniter和wordpress使用nginx进行安装,但博客内部URL无法正常运行

时间:2019-06-26 07:21:53

标签: wordpress codeigniter nginx

我已在根目录和/ blog目录中的WordPress博客上安装了代码点火器项目。但是博客的内部页面无法正常工作。以下是默认文件代码。尝试了社区提供的所有解决方案,但没有用。 //example.com/blog/sample-post/这不起作用。但是example.com/blog/?p=2可以使用。任何帮助将不胜感激

server {
listen 80 default_server;
server_name www.mydomain.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
listen [::]:443 ssl;

ssl_certificate /home/ssl/pte.crt;
ssl_certificate_key /home/ssl/pte.key;
root /var/www/html;

server_name www.mydomain.com;

# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

if (!-e $request_filename) {
     rewrite ^.*$ /index.php last;
}

location / {
   # First attempt to serve request as file, then
   # as directory, then fall back to displaying a 404.
   #try_files $uri $uri/ =404;
   try_files $uri $uri/ /index.php/?q=$uri&$args;
 }

 location /blog/ {
   try_files $uri $uri/ /blog/index.php
 }

 # pass PHP scripts to FastCGI server
 #
 location ~ \.php$ {
   include snippets/fastcgi-php.conf;
   # With php-fpm (or other unix sockets):
   fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
   # With php-cgi (or other tcp sockets):
   #fastcgi_pass 127.0.0.1:9000;
 }

 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 #location ~ /\.ht {
 #   allow all;
  #}

 }

0 个答案:

没有答案