Php 在运行Apache的Nginx上部署Centos上的Laravel 7
我正在尝试将我的Laravel应用程序部署到当前在Centos上运行Apache的私有服务器中。我知道我需要在另一个端口上运行它,因为apache当前正在运行服务器,这是我的.conf文件 /conf.d/apt-api.confPhp 在运行Apache的Nginx上部署Centos上的Laravel 7,php,laravel,apache,nginx,centos7,Php,Laravel,Apache,Nginx,Centos7,我正在尝试将我的Laravel应用程序部署到当前在Centos上运行Apache的私有服务器中。我知道我需要在另一个端口上运行它,因为apache当前正在运行服务器,这是我的.conf文件 /conf.d/apt-api.conf server { listen 81; server_name _; root /var/www/html/apt-api/public; index index.php;
server {
listen 81;
server_name _;
root /var/www/html/apt-api/public;
index index.php;
charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/www.sock;
}
location ~ /\.ht {
deny all;
可用站点
server {
listen 81;
# Log files for Debugging
access_log /var/log/nginx/mint-api-access.log;
error_log /var/log/nginx/mint-api-error.log;
# Webroot Directory for Laravel project
root /var/www/html/apt-api/public;
index index.php index.html index.htm;
# Your Domain Name
server_name default_server;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# PHP-FPM Configuration Nginx
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我在站点启用中有一个symlik
但是,当我尝试测试api路由时,我得到:
nginx error!
The page you are looking for is not found.
以这种方式访问它
http://SERVER_API:81/api/appointments
你知道为什么吗?你重启了nginx服务器吗?@HOSSAINAZADSHOHAG,是的,我重启了nginx。所有启用的
站点
,可用站点
等都是Debian/Ubuntu/等特定的东西。CentOS nginx版本通常为单个域使用/etc/nginx/conf.d/
中的单个文件,不使用可用的站点
或启用的站点
。但是,无论是在基于Debian还是RHEL的发行版中,您都可以按照自己的方式组织nginx配置。您的服务器上到底有什么发行版?这两个文件/conf.d/apt api.conf
和站点可用
是什么?它们为什么不同?它们在您的服务器上的物理位置在哪里?您是否重新启动了nginx服务器?@HOSSAINAZADSHOHAG,是的,我重新启动了nginx。所有启用的站点
,可用站点
等都是特定于Debian/Ubuntu/etc的东西。CentOS nginx版本通常为单个域使用/etc/nginx/conf.d/
中的单个文件,不使用可用的站点
或启用的站点
。但是,无论是在基于Debian还是RHEL的发行版中,您都可以按照自己的方式组织nginx配置。您的服务器上到底有什么发行版?这两个文件/conf.d/apt api.conf
和站点可用
是什么?它们为什么不同?它们在服务器上的物理位置是什么?