nginx-location

Nginx Yii2 configuration in different folders

末鹿安然 提交于 2019-11-29 15:44:06
I faced with problem in configuring nginx server for yii2 basic app. Here is my service block file : server { listen 80 ; access_log /var/log/nginx/access-server.log; error_log /var/log/nginx/error-server.log; charset utf-8; location /fetch { root /usr/share/nginx/html/another_folder/web/; try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } My project located in another folder "another

nginx configuration with multiple location blocks

三世轮回 提交于 2019-11-29 04:35:17
I'm trying to configure nginx to serve 2 different php scripts from 2 different location. The configuration is as follows. I have a Laravel installation which resides in /home/hamed/laravel in which its public directory should be served. I have a Wordpress installation in /home/hamed/www/blog . And this is my nginx configuration: server { listen 443 ssl; server_name example.com www.example.com; #root /home/hamed/laravel/public; index index.html index.htm index.php; ssl_certificate /root/hamed/ssl.crt; ssl_certificate_key /root/hamed/ssl.key; location /blog { root /home/hamed/www/blog; try

How to exclude specific subdomains server_name in nginx configuration

旧时模样 提交于 2019-11-29 04:04:45
I'm using wildcard in server_name . I want to redirect all subdomains of example.com (configured as *.example.com) to foo.com except xyz.example.com I have configuration as follows server { listen 80; server_name *.example.com; location / { proxy_pass http://$1.foo.com; } } I don't want to change any request coming to xyz.example.com You need at least two server blocks, and nginx will select the more specific server block to handle the request. See this document for details. You will need a server block for xyz.example.com such as: server { listen 80; server_name xyz.example.com; location / {

Nginx subdirectory root with PHP

独自空忆成欢 提交于 2019-11-28 05:49:52
问题 I'm running nginx in a docker container. I want to have a subdirectory /web/ to access my personal files and projects. It should also support php. Below is what I'm running with but domain-a.com/web keeps resulting in a 404. PHP is confirmed working since the same php block works on a subdomain but directly in a server{} block. http { server { listen 443 ssl; server_name domain-a.com domain-b.com; # Mime types include /etc/nginx/confs/mime.types; # SSL include /etc/nginx/confs/nginx-ssl.conf;

How can I have same rule for two locations in NGINX config?

折月煮酒 提交于 2019-11-28 03:17:16
How can I have same rule for two locations in NGINX config? I have tried the following server { location /first/location/ | /second/location/ { .. .. } } but nginx reload threw this error: nginx: [emerg] invalid number of arguments in "location" directive** curtwphillips Try location ~ ^/(first/location|second/location)/ { ... } The ~ means to use a regular expression for the url. The ^ means to check from the first character. This will look for a / followed by either of the locations and then another / . Another option is to repeat the rules in two prefix locations using an included file.

nginx configuration with multiple location blocks

时光总嘲笑我的痴心妄想 提交于 2019-11-27 18:36:09
问题 I'm trying to configure nginx to serve 2 different php scripts from 2 different location. The configuration is as follows. I have a Laravel installation which resides in /home/hamed/laravel in which its public directory should be served. I have a Wordpress installation in /home/hamed/www/blog . And this is my nginx configuration: server { listen 443 ssl; server_name example.com www.example.com; #root /home/hamed/laravel/public; index index.html index.htm index.php; ssl_certificate /root/hamed

How to exclude specific subdomains server_name in nginx configuration

倖福魔咒の 提交于 2019-11-27 16:28:59
问题 I'm using wildcard in server_name . I want to redirect all subdomains of example.com (configured as *.example.com) to foo.com except xyz.example.com I have configuration as follows server { listen 80; server_name *.example.com; location / { proxy_pass http://$1.foo.com; } } I don't want to change any request coming to xyz.example.com 回答1: You need at least two server blocks, and nginx will select the more specific server block to handle the request. See this document for details. You will