Nginx.conf server blocks to separate .conf based on server_name
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I was just looking at the question here:
extract servers' blocks from Nginx conf
but it missed the closing '}' for the server block and i want to extract all the server blocks in the nginx.conf file to separate .conf files based on the first server_name of each block. the file might look like so:
server { # php/fastcgi
listen 80;
server_name domain1.com www.domain1.com;
access_log logs/domain1.access.log main;
root html;
location ~ .php$
fastcgi_pass 127.0.0.1:1025;
server css' for the server block and i want to extract all the server blocks in the nginx.conf file to separate .conf files based on the first server_name of each block. the file might look like so:
server { # php/fastcgi
listen 80;
server_name domain1.com www.domain1.com;
access_log logs/domain1.access.log main;
root html;
location ~ .php$
fastcgi_pass 127.0.0.1:1025;
server static)/
root /var/www/virtual/big.server.com/htdocs;
expires 30d;
# pass requests for dynamic content to rails/turbogears/zope, et al
location /
proxy_pass http://127.0.0.1:8080;
What i need is after running the code i get 2 .conf files for each server block.
Server running Centos 6,7 and don't have any restrictions regarding code or tools.
Thank you.
linux bash centos scripting python
linux bash centos scripting python
linux bash centos scripting python
asked Jun 6 at 12:00
Diablo2050
11
11
add a comment |Â
Found a good answer at stackoverflow.com/questions/9634953/â¦
â Diablo2050
Jun 6 at 12:16
Found a good answer at stackoverflow.com/questions/9634953/â¦
â Diablo2050
Jun 6 at 12:16
Found a good answer at stackoverflow.com/questions/9634953/â¦
â Diablo2050
Jun 6 at 12:16
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Â
draft saved
draft discarded
Â
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448183%2fnginx-conf-server-blocks-to-separate-conf-based-on-server-name%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Found a good answer at stackoverflow.com/questions/9634953/â¦
â Diablo2050
Jun 6 at 12:16