我正在尝试配置该站点以使用Nginx和Apache。当我尝试访问该站点时,我得到一个403错误。
在文件***/etc/httpd/conf/httpd.conf***中,我设置了默认端口8089(因为8080已经很忙碌):
Listen 127.0.0.1:8089
接下来,我为Apache创建一个配置文件(***/etc/httpd/conf.d/site.conf***):
<VirtualHost 127.0.0.1:8089>
ServerName site.com
ServerAlias www.site.com
DocumentRoot "/usr/share/site/public"
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
<Directory "/usr/share/site/public">
Require all granted
AllowOverride all
</Directory>
</VirtualHost>
最后,我为Nginx创建了一个配置文件(/etc/nginx/conf.d/site.conf):
server {
listen 80;
server_name site.com www.site.com;
root /usr/share/site/public;
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 {
proxy_pass http://localhost:8089;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ /\.ht {
deny all;
}
}
有什么问题吗?
1条答案
按热度按时间m528fe3b1#
日安!
请尝试使用laravel ref link https://laravel.com/docs/7.x/deployment提供的原始配置
注意:
fastcgi_pass
您需要根据您的版本更改php{version}-fpm.sock;