问题描述
我在具有多个服务器块和多个域的数字海洋服务器上部署了一个 Laravel 8 应用程序,所有其他域都可以正常工作,因为它们不是 Laravel 应用程序。
我跟着这个教程https://www.digitalocean.com/community/tutorials/automatically-deploy-laravel-applications-deployer-ubuntu
一切正常。这意味着我设法成功部署。
但是当我访问域名时。它显示/目录的索引和目录
current
,shared
,release
我也跟着这个 https://deployer.org/docs/how-to-deploy-laravel.html 我不得不编辑我的 etc/Nginx/sites-available/example.co.vx
以将它指向 current/public
文件夹。目前文件看起来像这样
##
# You should look at the following URL's in order to grasp a solid unders>
# of Nginx configuration files in order to fully unleash the power of Ngi>
# https://www.Nginx.com/resources/wiki/start/
# https://www.Nginx.com/resources/wiki/start/topics/tutorials/config_pitf>
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases,administrators will remove this file from sites-enabled/>
# leave it as reference inside of sites-available where it will continue >
# updated by the Nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications,such as Drupal or wordpress. These applications will be m>
# available underneath a path with that package name,such as /drupal8.
#
# Please see /usr/share/doc/Nginx-doc/examples/ for more detailed example>
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.co.vx www.example.co.vx
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
# root /var/www/example.co.vx/public_html;
root /var/www/example.co.vx/public_html/current/public;
# Add index.PHP to the list if you are using PHP
index index.PHP index.html index.htm index.Nginx-debian.html;
# server_name example.co.vx www.example.co.vx;
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 /index.PHP$is_args$args;
try_files $uri $uri/ /index.PHP?$query_string;
}
# pass PHP scripts to FastCGI server
#
location ~ \.PHP$ {
include snippets/fastcgi-PHP.conf;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_scri>
fastcgi_param DOCUMENT_ROOT $realpath_root
# With PHP-fpm (or other unix sockets):
fastcgi_pass unix:/run/PHP/PHP7.4-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 {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.co.tz/fullchain.pe>
ssl_certificate_key /etc/letsencrypt/live/example.co.tz/privkey.>
include /etc/letsencrypt/options-ssl-Nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlin>
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
我还是遇到了同样的问题。
所以我认为这是我的 apache2 服务的问题
所以我编辑了我的 VirtaulHost 文件 /etc/apache2/sites-enabled/example.co.vx.conf
现在看起来像这样
<VirtualHost *:8080>
ServerName example.co.vx
ServerAlias www.example.co.vx
DocumentRoot /var/www/example.co.vx/public_html/current/public
<Directory /var/www/example.co.vx/public_html/current/public>
AllowOverride All
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.co.vx [OR]
RewriteCond %{SERVER_NAME} =www.example.co.vx
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
这一切都是徒劳的,我仍然有同样的错误。
截至目前,当我像 /var/www/example.co.vx/public_html/current/public/index.PHP
这样浏览 url 时,我可以查看页面,但无法加载图像和其他文件和页面。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)