Nginx rewrite question

Hey guys, one quick question regarding nginx and its rewrite rules. Currently on the a recently setup server, with /srv/http as the document_root. I'm keeping it as the bare /srv/http/ so that I can do (domain)/wordpress or (domain)/owncloud etc etc at will, its simple, clean, direct. The only snag is if I just do (domain) I want it to default to the wordpress instance instead of a blank page.
I know Nginx can do something like this its rewrite rules, but im new enough to nginx that I'm not really sure on how to write them, in a way that would ONLY kick in if given a bare domain, and would leave all other variations, like (domain)/owncloud alone. I copied the server section of nginx.conf below, if someone could give me a hand that'd be awesome.
server {
        listen       80;
        server_name  example.com;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root  /srv/http;
            index  index.html index.htm index.php;

FathisAeril wrote: server {
        listen       80;
        server_name  example.com;
Nginx takes the most specific fit first, so the bare domain name gets the rest

Similar Messages

  • CSS11506 http header rewrite question

    Hi
    I read the ACE doc, and it said that cisco ACE supports the capability to rewrite http headers in both client requests and server responses. Is CSS11506 can do it?
    I have a lot of problems that application on the local server redirect https to http. Because the way they do installation which standard way and it can not fix or hardly to fix.
    I would like to get a tip to let css11506 rewrite the server's rewrite. is it possible?
    Any comments will be appropriated
    Thanks in advice
    julxu

    Hello Julxu,
    If I understand your question correctly, you are looking for the CSS rewrite the URL from http to https when the server sends a redirect to the client.  If I'm correct, then you can find out how to accomplish this in the Specifying Secure URL Rewrite sectioin of the CSS configuration guides.
    Hope this helps,
    Sean

  • NGINX Rewrite URL to point to specific APEX application

    Anyone know how I can rewrite "http://sales.mydomain.com" to "http://mydomain.com:8080/apex/f?p=101" using NGINX?
    This doesn't work....
    server {
       listen           80;
       server_name      sales.mydomain.com;
       access_log       /domains/mydomain/sales/access.log;
       error_log        /domains/mydomain/sales/error.log;
       keepalive_timeout 70;
       location / {
       root /domains/mydomain/sales;
       index index.html index.htm;
       proxy_pass       http://mydomain.com:8080/apex/f?p=101;
       ...Thanks in advance. Rob

    Sorted... I was over complicating... this works...
    rewrite ^         http://mydomain.com:8080/apex/f?p=101 redirect;

  • Apache Mod-Rewrite Question

    I'm using the following mod-rewrite rules on one my websites,
    which is a
    database-driven CMS:
    RewriteRule ^About/([a-zA-Z0-9_/-]+)/?$
    About/index.php?bout=$1 [L]
    RewriteRule ^World/([a-zA-Z0-9()_/-]+)/?$
    World/index.php?area=$1 [L]
    RewriteRule ^Topics/([a-zA-Z0-9_/-]+)/?$
    Topics/index.php?topic=$1 [L]
    I'd like to create another rule for the site's home page -
    index.php.
    I'm not sure how to write it to begin with...would I just
    replace
    "About/index" in the first example above with /index.php, or
    index.php?
    Also, if I establish a mod-rewrite rule for a page named
    index.php, then
    I suspect that might interfere with my other mod-rewrite
    rules, as all
    of the folders contain pages named index.php.
    Does anyone know how to write a mod-rewrite rule for a site's
    home page
    (index.php) that doesn't interfere with other index pages?
    Thanks.

    Why do you want to do this?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "David Blomstrom" <[email protected]> wrote in
    message
    news:e2hcak$np9$[email protected]..
    > I'm using the following mod-rewrite rules on one my
    websites, which is a
    > database-driven CMS:
    >
    > RewriteRule ^About/([a-zA-Z0-9_/-]+)/?$
    About/index.php?bout=$1 [L]
    > RewriteRule ^World/([a-zA-Z0-9()_/-]+)/?$
    World/index.php?area=$1 [L]
    > RewriteRule ^Topics/([a-zA-Z0-9_/-]+)/?$
    Topics/index.php?topic=$1 [L]
    >
    > I'd like to create another rule for the site's home page
    - index.php. I'm
    > not sure how to write it to begin with...would I just
    replace
    > "About/index" in the first example above with
    /index.php, or index.php?
    >
    > Also, if I establish a mod-rewrite rule for a page named
    index.php, then I
    > suspect that might interfere with my other mod-rewrite
    rules, as all of
    > the folders contain pages named index.php.
    >
    > Does anyone know how to write a mod-rewrite rule for a
    site's home page
    > (index.php) that doesn't interfere with other index
    pages?
    >
    > Thanks.

  • Cd/DVd Rewriter question hot to use

    Hi All,
    There is a CD/DVD (+-)rewriter in the computers. I know in Windows the Nero has inCd program what let write/read/delete on CD/DVD rewriter disk like HD (Not with the same speed. How can I do use in Mac OS X the rewriter similar like inCD just delete, write etc.?
    Thanks in advance.
    laci

    It sounds like you have a file that changes regularly, and you want to back it up to the same CD-RW disc over and over. Is that right?
    I use Automator for that. It's only a two-action workflow. The first is "Get specified Finder items" and then that is passed to "Burn disc". Make sure the "erase first" box is checked in the "Burn disc" action. Then save the file as an application. All you need to do is pop in the CD-RW and run the application, then grab a coffee while the disc is being burned.

  • .htacess rewrite question

    I am trying to perfect my .htaccess file and I have it all working except one of the re-write sections:
    Simply I am trying to re-write my domain to hide a section of it in the browser address bar as such . . .
    Currently it reads:
    https://www.hoodfellaent.secure.omnis.com
    but I would like it to always read:
    https://www.hoodfellaent.com/
    Basically I need it to mask but not get rid of the part that reads ".secure.omnis"
    Can someone please help me figure this out I have Googled this and altered a few different code snippets but I have not been able to make it work when I visit the website - I either get an error page or the address looks unchanged in the browser address bar.
    I need this to work before we upload our new web design!
    Thanks a bunch to anyone that can help!

    I don't think you can hide parent level URL paths from inside your virtual directory. That would have to be done from the top level by establishing a DNS Alias there or using the root level .htacess rules to rewrite the headers.
    Mylenium

  • URL Rewriting Question

    I am writing a servlet which needs to keep track of session id, session creation time, and last accessed time. It should also invalidate the session if the max inactive interval is exceeded. This should be easy to do with HttpSession. However, I have to deal with the situation that the client doesn't accept cookies, so I have to use URL rewriting.
    Could anyone tell me what's the best way to implement this? I appreciate your help.

    Hi
    You can find all servlet documentation throught the link: http://java.sun.com/j2ee/docs.html
    Look for the Java 2 SDK, Enterprise Edition, API docs
    The "encodeURL" NB. Capital letters URL, takes a URL that shall be encoded and (if needed) adds the session ID, the returned string is an URL that you put in the '' statement. You do not need to do anything on the client side, If they have disabled cookies you will problaby get troubles with Java and javascript to... what this thing does is add a note that tells the webserver to which session each call belongs.
    Hope this helps
    //Samuel

  • Pass IR Filters to Interactive Report

    I am calling my Interactive Reports from a menu with IR filters ('SCHOOL' and 'YEAR') being passed to the report. I'm wondering if the interactive report queries all the data first and then applies the IR filters (which would be a performance problem). I ran the report in debug, but I'm not really sure how it evaluates the SQL. Does anybody know how passing IR filters to report work in the execution of the SQL?
    select
    null as apxws_row_pk,
    "ATTENDANCE_CODE",
    "ATTENDANCE_CODE_DESC",
    "PK_ID",
    count(*) over () as apxws_row_cnt
    from (
    select * from (
    select A.PK_ID as "PK_ID",
    A.YEAR as "FK_YEAR",
    A.FK_SCHOOL as "FK_SCHOOL",
    A.ATTENDANCE_CODE as "ATTENDANCE_CODE",
    A.ATTENDANCE_CODE_DESC as "ATTENDANCE_CODE_DESC",
    C.SCHOOL_YEAR as "YEAR"
    from "#OWNER#"."SCHOOL_YEAR" C,
    "#OWNER#"."SCH_BASE" B,
    "#OWNER#"."ATTENDANCE_CODE" A
    where B.PK_ID = A.FK_SCHOOL
    and C.PK_ID = A.YEAR
    ) r
    where ("SCHOOL" = :APXWS_EXPR_1
    and "YEAR" = to_number(:APXWS_EXPR_2))
    ) r where rownum <= to_number(:APXWS_MAX_ROW_CNT)
    order by "ATTENDANCE_CODE"

    Stew
    The information was not specific to rewrite, I was merely trying to show how tracing could be enabled to determine what the optimizer is doing (which was appropriate to the rewrite question). It will also show you the query actually being performed and the execution plan.
    This information would allow you to see the query being passed to oracle by Apex and what predicates are in the query passed, which would go some way to answering the original question.
    To your question a'n oracle SQL query is an oracle SQL query' - I'm not quite sure what you mean. Two differently constructed queries over the same tables, returning the same results can differ wildly in performance. Understanding the optimizer and the decisions it makes will change the way in which you write queries.
    I've generally found out that the best way to determine what happens behind the scenes is to have a look. Getting information from the experts is fantastic, but working it out yourself or even just testing to confirm the answers you are given helps understanding even more.
    Ben
    Looking at the rownum clause, it will speed up the query if the ORDER BY clause is removed. If you are ordering the results, the entire result set must be returned first in order to get the first x rows. Without ordering, this is required.
    Edited by: Munky on Jan 16, 2009 3:51 PM

  • Cannont connect to itunes

    Awesome i have to rewrite question bc now i dont have the authorization to look at my previous question? ***
    I cannot connect to itunes, this is what it tells me after i select an app, install app, enter in some stupid info about my address n such and than i get the cannot connect to itunes pop-up. Was on the phone with apple care for couples hours. They knew nothing. Told me to wait for an email that never came, or to call back if i didnt receive it, which of course ended up happening and had to wait on hold for another 30 mins to speak to someone who didnt have any idea why it wouldnt be working, go figure.
    Is it even worth going to a apple store and asking them for help?

    just go to the summary panel and restore the device, you do that by just clicking on the name of the device under devices

  • [SOLVED] nginx, php-cgi, rewrite url, 502 bad gateway.

    Hello everyone.
    I just set my nginx server, with php-cgi, as it is in the wiki site and it is working perfectly. I have just one problem. I am trying to rewrite my url, and I got an error after several refreshes.
    This is my site configuration.
    server {
    listen 80;
    server_name localhost testwebsite testwebsite.homelinux.org;
    access_log logs/testwebsite.access.log main;
    location / {
    root /home/www/testwebsite;
    index index.php;
    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?path=$1 last;
    #rewrite ^/((.*)[^/])$ /index.php?path=$1 last;
    location ~ \.php$ {
    #root www;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /home/www/testwebsite/$fastcgi_script_name;
    include fastcgi_params;
    When I am not trying to rewrite the url, everything is ok, but when I try to rewrite it, after several refreshes on the page, I got nginx error: 502 bad gateway, and the cgi deamon stops to work.
    When I restart the fastcgi (I am using the example /etc/rc.d/fastcgi file as it is in the wiki) the web site is working again for several refreshes, and then the fastcgi stops again and I got the bad gateway again.
    Can someone tell me what is wrong with my rewrite rule, please.
    Regards.
    Last edited by Gruntz (2010-04-08 15:58:50)

    I fixed it with that rewrite:
    rewrite  ^([^.]*)$  /index.php?path=$1;

  • I asked a question earlier, but got the site wrong. It is NGINX

    ''that thread is here - https://support.mozilla.com/en-US/questions/844985 - edited that thread and am locking this one as a duplicate''
    I asked about this problem earlier today, but got the name wrong . It is NGINX. I said NGENX

    #Log in/sign in to the forum with your username and password.
    #*Forum: https://support.mozilla.com/en-US/questions
    #Click on "My Contributions" just above the first question listed to see your questions and questions from others to whom you have posted a reply.
    '''Are you really using Firefox 3.5.4?'''
    That version is no longer supported.
    Check your version: Help > About Firefox (or About Mozilla Firefox, in older versions)
    *See: [https://support.mozilla.com/en-US/kb/Finding%20your%20Firefox%20version Finding your Firefox version]
    You may need to reset your User-agent. See:
    *[https://support.mozilla.com/en-US/kb/new?title=Web+sites+or+add-ons+incorrectly+report+incompatible+browser Web sites or add-ons incorrectly report incompatible browser]
    *[http://kb.mozillazine.org/Resetting_your_useragent_string_to_its_compiled-in_default Resetting your useragent string to its compiled-in default]

  • IMS 5.2 Rewrite/Channel question

    I have read through every post on here that I can find related to rewrite rules and channel definitions, and can't find a solution to my problem. Perhaps I'm just missing something, but I figure it's time to ask the experts.
    Let's say that I have two domains hosted on my mail store (iMS5.2, Direct LDAP mode) of domain1.com and domain2.com. domain1.com is the default domain. In front of the mail store, I have a system (mmp1) installed as the mailmultiplexor software installed, but also has iMS5.2 installed on it, just serving as an SMTP server. When a customer of ours with an email address of <anything>@domain1.com or <anything>@domain2.com sends email through mmp1 (which they have to because it's the only one they have access to from outside the firewall), I want any mail being sent to <anyone>@domain2.com to be delivered via the MX record for domain2.com, rather than having mmp1 do LDAP searches, finding the account locally and delivering it to the mail store directly.
    The reason for this is because domain2.com is a filtered domain that gets passed to an outside service (via MX records) to have the mail filtered, then that service sends it back, directly to the mail store.
    I'm certain that this is possible, but I can't get it to work. mmp1 always searches the database and tries to deliver the message directly. Any help would be greatly appreciated. Thanks in advance!

    just a guess...
    If the mailhost for [email protected] becomes your iMS5.2 MTA instead of your mail store, do you think the mmp will route the mail through that MTA instead of directly to the mailstore ? If yes, then, you could add a few lines in imta.cnf:
    domain2.com $U%$D@tcp_domain2-daemon
    tcp_domain2 daemon your_mx_record_here [...]
    tcp_domain2-daemon
    Let us know..
    Martin

  • Question on rewriting url

    I have a site www.mydomain.org that also has the .com and .net registered and pointing to the same site. What we would like to do is when someone goes to www.mydomain.com, have the url in the browsers address bar change to www.mydomain.org. We don't want to use redirects, but just have the url change in the browser, because redirects will mess with our web stats. Any ideas?

    Thank you very much. It's very helpful to know the
    cache is based on the complete URL including
    querystring. Is there any docs about it?
    so if I add 3 meta tag to my jsp, proxy or browser
    should not cache?Well, not really. I'm sorta making an assumption here, honestly. The reason is that any caching proxy server can do whatever it wants to associate a cached page with a URL. IF it wants to ignore the query string part of a URL, it could simply trim that. But from the ones I've seen, the full URL was used.
    If you use those response headers, it shouldn't cache in the proxy or browser.
    then the only thing I am worry now is that the
    sessionID is in url, is it easy stolen by someone
    else? I used session very heavy in my app. so if the
    sessionID is not secure enough, it's very dangerous.It doesn't matter if the session ID is in the URL or a cookie. Someone could "steal" it from either place easily enough. It'd still be in the request from the browser, and it has to be because of how the HTTP protocol works. The only way to make it secure is to use SSL.
    The session should always timeout anyway so that the session ID isn't good forever.

  • IIS 7.5 URL Rewrite: Hit specific page of a web application but should be redirected to another application's page

    I have deployed 2 different web application on IIS 7.5 running on Windows Server 2008 R2 but on different port numbers i.e. one application deployed on port no. 1776 and another on 8091. I want to rewrite URL in such a way that if i hit any page of first
    application such as default.aspx then it will be redirected to particular page of another application along with some changes in url.
    Example: if i access any page from first application like:
    http://g2wv126rbsc:1776/sites/main/commercial/commercial-solutions/financing/default1.aspx
    then it should redirect to specific page of another application along with some changes in url:
    http://g2wv126rbsc:8091/main/commercial/commercial-solutions/financing/default2.aspx
    Note: In above mentioned url, also removed "sites".
    I tried to create a inbound rule through URL Rewrite module (installed on IIS 7.5) by selecting Action as "Rewrite" but didn't find any success.
    I need some examples if anyone has come across same kind of issue.
    Thanks in advance.

    Please post ASP.NET questions in the ASP.NET forums (http://forums.asp.net ).

  • Report Generation Toolkit Error Quick Question

    Hi,
         I created the most awesome LabVIEW report ever at my desk using a trial version of the RGT and Office 2003.  I took this to my production machine and ")@#(&%(*#^%()^!!!"  The production machine has office 2007 and a fully licensed version of the RGT.  Both machines have LabVIEW 8.6.0.  I've read all the stuff about these errors and something about classes and dll's and whatnot's.  So my quick question, is:  Instead of matching the versions of Microsoft Office as recommended, can I just rewrite from scratch the VI that creates this world's most awesome LabVIEW report on the production machine to create the same effect? 
    Solved!
    Go to Solution.

    Hi 
    Quick Answer: Probably
    Slower answer: Microsoft changed a lot of things behind the scenes in Office 2007, but the Report Generation toolkit version 1.1.3 supports Office 2007 so you should be good to go. Depends on what functions are included in your VI. Liek the read me says "Several default settings in Microsoft Office 2007 differ slightly from previous versions. Reports you generate using Office 2007 might look different than reports you generate from other versions of Office because font sizes, cell sizes, and so on, differ."
    Best Regards
    David
    NISW

Maybe you are looking for

  • Oracle 11g : UTL_FILE query

    Hi, I am having 2 server. One server has oracle database while on another one is application server where all the data files and application specific shell scripts are kept. We are connecting to database via the application server. I am using Oracle

  • Problem with Keymaps

    Hi, I got a problem with a user-defined keymap. Here is a fragment of my code: for (int i = 0; i <= 1; i++) { keymap[i] = textField.addKeymap("Bindings" + i, textField.getKeymap()); prepare_keymap(i); textField.setKeymap(keymap[actKeymap]); private s

  • DB2 to Oracle 11g migration

    Hi, We are migrating the siebel database from DB2 to Oracle 11g. While doing the migration, the following values are found for the siebel related tables on DB2. for example: CREATE TABLE S_SERVICE_SCRPT ( ROW_ID NVARCHAR2(15) NOT NULL, CREATED TIMEST

  • How to mail merge a document with in database?

    Dear All, I would like to know how to implement mail merge functionality in side pl/sql body. I could open, edit a document using the package ORDWord. Morethan, that anybody know, how to merge the documents ? Or please let me know any other workaroun

  • Important tables in MM and PP

    Hi,   Hi could any one tell me the MM and PP flow,important tables ,fields,and the linkage between them. Regards, Charumathi.B