我让这个服务器运行LEMP托管在数字海洋上。我使用它有两个原因:
我想迁移到Vapor。但我对它的工作方式有疑问。
旧版和运行PHP
用户通常访问: example.com/news_service.php
新蒸汽版
我想创建一个类似的"get“地址: example.com/news/service
问题:
有没有人知道,如果安装Swift和Vapor,我可能会破坏我的旧系统?为了建立这个新系统,我还得再弄点水滴吗?是否有可能将所有请求重定向到某个文件夹,只有该文件夹将运行Vapor应用程序(获取请求),而其他所有请求都在LEMP上运行?
发布于 2020-02-21 02:12:37
感谢I --marc I指出“服务器块”,我可以转到
$ cd /etc/nginx/sites提供
并添加您想要使用的地址-在我的例子中是/iOSService/
到该路径的任何请求都将由运行在端口8080上的Vapor处理
location /iOSService/ {
proxy_ignore_client_abort on;
proxy_pass http://localhost:8080/;
proxy_redirect off;
}此外,如果您希望phpmyadmin继续工作,请确保将这些行保留在那里:
# Phpmyadmin Configurations
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
# PHPmyadmin configurations ends最后,为了继续为您的文件服务,请不要忘记:
location / {
try_files $uri $uri/ =404;
}https://stackoverflow.com/questions/60197612
复制相似问题