没有指定输入文件 nginx 子文件夹

没有指定输入文件 nginx 子文件夹

我在这个网站上搜索了很多与我的问题标题相同的结果,但我找不到适合我的,这是我的问题:我在 ubuntu 上安装了 nginx

现在一切都正常,但是当我尝试创建一个新的子文件夹“for exam /var/www/html”时,我的子文件夹是“/var/www/html/test1”,并且在这个文件夹中有一个index.php文件,我可以通过在“/etc/nginx/site-avaiable-default”中添加新位置/test1来使其访问“/var/www/html/test1”,而不会出现“未指定输入文件”错误,

但是当我想添加 2 或 3 个新的子文件夹时会发生什么?

测试2,测试3,测试4。

所以我必须再次打开“默认”文件并为每个子文件夹添加“location /test$”,这种方式并不灵活。如何在全局中处理它,这意味着当我创建一个新的子文件夹时,我不想再得到“未指定输入文件”?

这是我的配置

    server {

 server_name localhost;
 root /var/www/html; ## <-- Your only path reference.
 index index.html index.php;
 # Enable compression, this will help if you have for instance advagg module
 # by serving Gzip versions of the files.
 gzip_static on;

 location = /favicon.ico {
 log_not_found off;
 access_log off;
 }

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

 # This matters if you use drush prior to 5.x
 # After 5.x backups are stored outside the Drupal install.
 #location = /backup {
 # deny all;
 #}

 # Very rarely should these ever be accessed outside of your lan
 location ~* \.(txt|log)$ {
 allow 192.168.0.0/16;
 deny all;
 }

 location ~ \..*/.*\.php$ {
 return 403;
 }

 # No no for private
 location ~ ^/sites/.*/private/ {
 return 403;
 }

 # Block access to "hidden" files and directories whose names begin with a
 # period. This includes directories used by version control systems such
 # as Subversion or Git to store control files.
 location ~ (^|/)\. {
 return 403;
 }

 location / {
 # This is cool because no php is touched for static content
 try_files $uri @rewrite;
  autoindex on;
 }

  location /drupal {
 # This is cool because no php is touched for static content
# try_files $uri @rewrite;
  autoindex on;
 }


 location @rewrite {
 # You have 2 options here
 # For D7 and above:
 # Clean URLs are handled in drupal_environment_initialize().
 rewrite ^ /index.php;
 # For Drupal 6 and bwlow:
 # Some modules enforce no slash (/) at the end of the URL
 # Else this rewrite block wouldn't be needed (GlobalRedirect)
 #rewrite ^/(.*)$ /index.php?q=$1;
 }

 location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $request_filename;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
 fastcgi_intercept_errors on;
 fastcgi_pass unix:/var/run/php5-fpm.sock;
 }

 # Fighting with Styles? This little gem is amazing.
 # This is for D6
 #location ~ ^/sites/.*/files/imagecache/ {
 # This is for D7 and D8
 location ~ ^/sites/.*/files/styles/ {
 try_files $uri @rewrite;
 }

 location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
 expires max;
 log_not_found off;
 }

}

在本次考试中,“drupal”是我的子目录

location /drupal {
 # This is cool because no php is touched for static content
# try_files $uri @rewrite;
  autoindex on;
 }

有没有办法创建新的 drupal1、test1、blabla,而无需执行这样的操作

太感谢了。

相关内容