【发布时间】:2020-04-15 13:14:05
【问题描述】:
我正在尝试创建一个带有 php 网站演示链接的登录页面,如下所示:
https://demos.infinitywebservices.tn/ : landing page
https://demos.infinitywebservices.tn/demo1/public : takes to demo1 app
https://demos.infinitywebservices.tn/demo2/public : takes to demo2 app
...等等
我在 Debian 9 服务器上使用 Nginx
我的/etc/nginx/sites-available/infinitywebservices.conf
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
root /var/www/tony-projects/infinitywebservices/demos;
index index.php index.html index.htm;
server_name demos.infinitywebservices.tn www.demos.infinitywebservices.tn;
gzip on;
gzip_vary on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)\$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~* \.(?:css|js)\$ {
expires 7d;
access_log off;
add_header Cache-Control "public";
}
ssl_certificate /...; # managed by Certbot
ssl_certificate_key /...; # managed by Certbot
}
我的目录结构
/var/www
|__tony-projects
|__infinitywebservices
|__demos
|__ index.php (Landing page for demos.infinitywebservices.tn/)
|__ demo1 (Laravel Project)
|__ demo2 ...
|
|.....
附言
- 我目前在
demo1下使用默认的.htaccess配置和demo2Laravel 项目 目前只有主页有效在我尝试访问子网站时 像
https://demos.infinitywebservices.tn/demo1/public/这样的项目(参见:https://demos.infinitywebservices.tn/laravel-test/public)但是对于
https://demos.infinitywebservices.tn/laravel-test/public/test(路线测试存在),我得到404 Not Found nginx/1.10.3
我在这里缺少什么?
【问题讨论】:
-
只是指出
.htaccess是用于 apache 而不是 nginx -
哦,谢谢你的信息