# How to write ScriptAlias in nginx.conf like in httpd.conf

**URL:** <https://www.ruby-forum.com/t/how-to-write-scriptalias-in-nginx-conf-like-in-httpd-conf/222008>\
**Category:** NGINX\
**Created:** [August 9, 2012, 12:55am UTC](https://www.ruby-forum.com/t/how-to-write-scriptalias-in-nginx-conf-like-in-httpd-conf/222008 "2012-08-09T00:55:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 9, 2012, 12:55am UTC](https://www.ruby-forum.com/t/how-to-write-scriptalias-in-nginx-conf-like-in-httpd-conf/222008/1 "2012-08-09T00:55:58Z")

</div>

I have to configure nginx.conf just like the httpd.conf and stuck while  
configuring ScriptAlias. I have

ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”

i want to write the above in nginx.conf. How can I write it?

---

<div class="post-metadata">

**Author:** ![swapnil\_p](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@swapnil\_p](https://www.ruby-forum.com/u/swapnil_p)\
**Post date:** [August 9, 2012, 1:08am UTC](https://www.ruby-forum.com/t/how-to-write-scriptalias-in-nginx-conf-like-in-httpd-conf/222008/2 "2012-08-09T01:08:46Z")

</div>

On Thu, Aug 09, 2012 at 12:55:58AM +0200, Swapnil P. wrote:

Hi there,

> I have to configure nginx.conf just like the httpd.conf and stuck while  
> configuring ScriptAlias. I have
> 
> ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”
> 
> i want to write the above in nginx.conf. How can I write it?

location /cgi-bin/ {  
proxy\_pass http://apache\_server:apache\_port  
}

(ScriptAlias in apache httpd is for configuring CGI handling. nginx  
doesn’t handle CGI, so you need to decide how you want the urls to be  
handled. This version just proxies them to your running apache.)

Depending on the rest of your nginx.conf, you may want " ^~" after  
“location”.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#location)**
>
> This directive appeared in version 1.11.8.

> **[Module ngx\_http\_proxy\_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass)**
>
> The ngx\_http\_proxy\_module module allows passing requests to another server.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
